PDA

View Full Version : [CLOSED] Combobox editor selected value



bayoglu
Jan 30, 2013, 5:33 PM
Hello forum,

I have two questions.

1) Combobox editor (Link column) returns display field instead of value field. As a result, renderer function does not work. What is the problem? I read some related posts and saw SVN update could fix the issue. Unfortunately I do not have my SVN login credentials yet.

Code:



<%@ Page Language="C#" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
GridPanel1Store.DataSource = new object[]
{
new object[] { 1, 1, "A"},
new object[] { 2, 1, "B"},
new object[] { 3, 1, "C"},
new object[] { 3, 2, "D"},
new object[] { 3, 2, "E"}

};
GridPanel1Store.DataBind();

ComboBox1Store.DataSource = new object[]
{
new object[] { 1, "Link 01"},
new object[] { 2, "Link 02"},
new object[] { 3, "Link 03"}
};
ComboBox1Store.DataBind();
}
}
</script>

<!DOCTYPE html>

<html>
<head id="Head1" runat="server">
<title>"Combobox editor"</title>
<script type="text/javascript">
var linkRenderer = function(value, record) {
if (value == "") {
return "Not defined";
}
else {
var selectedLink = App.ComboBox1Store.getById(value);
if (selectedLink == null) {
return "Not defined";
}
else {
return selectedLink.data.Name;
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server"/>
<ext:Store ID="ComboBox1Store" runat="server">
<Model>
<ext:Model ID="ComboBox1Model" runat="server" IDProperty="ID">
<Fields>
<ext:ModelField Name="ID" Type="Int"></ext:ModelField>
<ext:ModelField Name="Name" Type="String"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
<ext:Store ID="GridPanel1Store" runat="server">
<Model>
<ext:Model ID="GridPanel1Model" runat="server" IDProperty="ID">
<Fields>
<ext:ModelField Name="ID" Type="Int"></ext:ModelField>
<ext:ModelField Name="LinkID" Type="Int"></ext:ModelField>
<ext:ModelField Name="Name" Type="String"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
<div>
<ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
<Items>
<ext:Panel ID="Panel1" runat="server" Layout="FitLayout" AutoScroll="true">
<Items>
<ext:GridPanel ID="GridPanel1" runat="server" StoreID="GridPanel1Store" MinHeight="200">
<ColumnModel runat="server" ID="ColumnModel1">
<Columns>
<ext:Column ID="Column1" runat="server" Text="Name" DataIndex="Name" Align="Left" Flex="1">
</ext:Column>
</Columns>
<Columns>
<ext:Column ID="Column2" runat="server" Text="Link" DataIndex="LinkID" Align="Left" Flex="1">
<Editor>
<ext:ComboBox ID="ComboBox1" runat="server" DisplayField="Name" ValueFiled ="ID" Width="320" LabelWidth="130" QueryMode="Local" Editable="false" AllowBlank="false" MatchFieldWidth="false" StoreID="ComboBox1Store">
</ext:ComboBox>
</Editor>
<Renderer Fn="linkRenderer"></Renderer>
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Multi">
</ext:RowSelectionModel>
</SelectionModel>
<Plugins>
<ext:CellEditing ID="CellEditing1" runat="server">
</ext:CellEditing>
</Plugins>
</ext:GridPanel>
</Items>
</ext:Panel>
</Items>
</ext:Viewport>
</div>
</form>
</body>
</html>



2) When I click to edit Link cell, I do not want to display the underlying ID value of store. Instead I would like to show what the renderer function returns.

Please see image below:

5513

Thank you.

Baidaly
Jan 30, 2013, 11:02 PM
Hello!

I think you have to update from SVN, because with the last version of trunk your example works fine, except that you have to change ValueFiled on ValueField:


<ext:ComboBox ID="ComboBox1" runat="server" DisplayField="Name" ValueField="ID" Width="320" LabelWidth="130" QueryMode="Local" Editable="false" AllowBlank="false" MatchFieldWidth="false" StoreID="ComboBox1Store">
</ext:ComboBox>

Daniil
Jan 31, 2013, 4:05 AM
Hello,


Unfortunately I do not have my SVN login credentials yet.

The SVN credentials should be emailed to you when you bought the license. Please check the inbox.

If it is lost, please send a request to support@object.net.

bayoglu
Jan 31, 2013, 7:42 AM
Hello!

I think you have to update from SVN, because with the last version of trunk your example works fine, except that you have to change ValueFiled on ValueField:


<ext:ComboBox ID="ComboBox1" runat="server" DisplayField="Name" ValueField="ID" Width="320" LabelWidth="130" QueryMode="Local" Editable="false" AllowBlank="false" MatchFieldWidth="false" StoreID="ComboBox1Store">
</ext:ComboBox>

Thank you Baidaly, it was all about ValueField > ValueFiled typo. Please mark as closed.

bayoglu
Jan 31, 2013, 7:44 AM
Hello,



The SVN credentials should be emailed to you when you bought the license. Please check the inbox.

If it is lost, please send a request to support@object.net.

Hi Danil, we did not get the email. I sent a request to support@object.net. Hopefully will be taken care soon. Thank you.

Daniil
Jan 31, 2013, 8:41 AM
Hi Danil, we did not get the email. I sent a request to support@object.net. Hopefully will be taken care soon. Thank you.

Thank you. I will personally notify our manager.

bayoglu
Jan 31, 2013, 3:05 PM
Thank you. I will personally notify our manager.

Thank you Daniil, still no luck with SVN credentials ;(