PDA

View Full Version : [CLOSED] Rendering Combobox dynamically in gridpanel



iansriley
Dec 08, 2014, 4:42 PM
Hi,

I have a requirement that I need render a combobox in a gridpanel dynamically depends on other column value.

Grid panel is


<ext:GridPanel ID="GridPanel2" runat="server" Title="" Frame="false" Scroll="Vertical"
AutoScroll="true" Header="false">
<Store>
<ext:Store ID="Store2" runat="server" GroupField="XX">
<Model>
<ext:Model ID="Model4" runat="server">
<Fields>
........
<ext:ModelField Name="Frequency" Type="Int" />
<ext:ModelField Name="DefaultFrequency" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel2" runat="server">
<Columns>
...........
<ext:Column ID="Column7" runat="server" Text="DefaultFrequency" Hidden="true" DataIndex="DefaultFrequency" />
<ext:ComponentColumn ID="ComponentColumn1" runat="server" Editor="true" DataIndex="Frequency"
Text="Frequency">
<Component>
<ext:ComboBox ID="cboFrequency" StoreID="storeFrequency" runat="server" EmptyText="Select" DisplayField="Type"
ValueField="Id">
</ext:ComboBox>
</Component>
</ext:ComponentColumn>
</Columns>
</ColumnModel>
</ext:GridPanel>


combobox cboFrequency Store contain following data
Id Type
1 Daily
2 Weekly
3 Monthly
4 Quarterly
5 Yearly

Format of store is

<ext:Store ID="storeFrequency" runat="server"> <Model>
<ext:Model ID="Model2" runat="server">
<Fields>
<ext:ModelField Name="Id" Type="Int">
</ext:ModelField>
<ext:ModelField Name="Type" Type="String">
</ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>

If DefaultFrequency is "3,2,1" then combobox should bind respective items only to that combobox for that row

Please suggest me some solution on this requirement.

Thank you

Daniil
Dec 10, 2014, 9:26 AM
Hi @iansriley,

You can configure a ComponentColumn's Component in a ComponentColumn's BeforeBind event handler.

There is an example of using a BeforeBind event.
http://forums.ext.net/showthread.php?37581&p=170081&viewfull=1#post170081