PDA

View Full Version : [CLOSED] ComboBox.SelectedItem.Value is null in DirectEvents Select



canusr1
Jul 22, 2013, 5:34 AM
Hi,

How to get the ComboBox.SelectedItem.Value in DirectEvents Select Method?
ComboBox.SelectedItem.Value is always null in Select event.
I want to display Name in GridPanel's FieldName col when the ComboBox Selected Item value is changed.



<ext:GridPanel
ID="GridPanel1"
runat="server">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model2" runat="server">
<Fields>
<ext:ModelField Name="Field_ID" Type="String" />
<ext:ModelField Name="Field_Name" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<View>
<ext:GridView ID="GridView1" runat="server" TrackOver="false" />
</View>
<ColumnModel ID="ColumnModel2" runat="server">
<Columns>
<ext:Column ID="Column1" runat="server" Text="Field_ID" DataIndex="Field_ID">
<Editor>
<ext:ComboBox ID="ddlField_ID"
runat="server"
QueryMode="Local"
Editable="false"
DisplayField="Field_Name"
ValueField="Field_ID"
EmptyText="-- Select--"
TriggerAction="All"
SelectOnFocus="true">
<Store>
<ext:Store ID="Store2" runat="server">
<Model>
<ext:Model ID="Model4" runat="server" IDProperty="Field_ID">
<Fields>
<ext:ModelField Name="Field_ID" />
<ext:ModelField Name="Field_Name" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store> <DirectEvents>
<Select OnEvent="ddlField_ID_ItemSelected">
</Select>
</DirectEvents>
</ext:ComboBox>
</Editor>
</ext:Column>
<ext:Column ID="colField_Name" runat="server" Text="Field_Name" DataIndex="Field_Name">
</ext:Column>
</Columns>
</ColumnModel>
<Plugins>
<ext:CellEditing ID="RowEdit">
</ext:CellEditing>
</Plugins>
</ext:GridPanel>




protected void ddlField_ID_ItemSelected(object sender, DirectEventArgs e)
{
string Name = ddlField_ID.SelectedItem.Value; // is always null
}

Daniil
Jul 22, 2013, 8:15 AM
Hi @canusr1,

A Column's Editor is not rendered to

<form runat="server">
so, its value is not submitted automatically.

If needed you can send it as an extra parameter of the DirectEvent.

<Select OnEvent="ComboBox_Select">
<ExtraParams>
<ext:Parameter Name="value" Value="records[0].data[this.valueField]" Mode="Raw" />
</ExtraParams>
</Select>

canusr1
Jul 22, 2013, 9:38 AM
Hi @canusr1,

A Column's Editor is not rendered to

<form runat="server">
so, its value is not submitted automatically.

If needed you can send it as an extra parameter of the DirectEvent.

<Select OnEvent="ComboBox_Select">
<ExtraParams>
<ext:Parameter Name="value" Value="records[0].data[this.valueField]" Mode="Raw" />
</ExtraParams>
</Select>

Hi Daniil,

Now I can get the ComboBox's selected value.
How to update this value in GridPanel's other column?
GridPanel is using different store.

Thanks

Daniil
Jul 22, 2013, 2:01 PM
Now I can get the ComboBox's selected value.


Did I not demonstrate it with the ExtraParams code snippet? If no, please clarify the requirement.



How to update this value in GridPanel's other column?


You should use a CellEditing's Edit listener.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.plugin.CellEditing-event-edit

canusr1
Jul 23, 2013, 3:40 AM
Did I not demonstrate it with the ExtraParams code snippet? If no, please clarify the requirement.



You should use a CellEditing's Edit listener.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.plugin.CellEditing-event-edit

Hi,

You can close the thread. I alreay got it.

Thanks.