PDA

View Full Version : [CLOSED] GridPanel - ComponentColumn - ComboBox: How to bind data??



jamesand
Aug 20, 2013, 11:44 AM
Hi and thank you in advance for your responses.

I'm trying to show a combobox in a gridpanel using ComponentColumn. The thing is that I'm not able to bind data. Data are not shown or the gridpanel is not shown.

I'm trying it in 2 ways:

1.
<ext:ComponentColumn ID="ComponentColumn1"
runat="server"
DataIndex="ESTADO"
Flex="1"
Text="Estado"
Editor="true">
<Component>
<ext:ComboBox ID="comboEstadoAsignacionIndividual" runat="server" DisplayField="Descripcion" ValueField="Valor"
QueryMode="Local" TypeAhead="true">
<Store>
<ext:Store ID="storeEstadoAsignacionIndividual" runat="server" Data="<%# Estados %>" AutoDataBind="true">
<Model>
<ext:Model ID="Model4" runat="server" IDProperty="Valor">
<Fields>
<ext:ModelField Name="Descripcion" Type="String" ServerMapping="Descripcion" />
<ext:ModelField Name="Valor" Type="Int" ServerMapping="Valor" />
</Fields>
</ext:Model>
</Model>
<Reader>
<ext:ArrayReader />
</Reader>
</ext:Store>
</Store>
</ext:ComboBox>
</Component>
</ext:ComponentColumn>

Where "Estados" return correctly a list (it is used correctly by another combobox outside the gridpanel):


Protected ReadOnly Property Estados() As List(Of ElementosEnumerados)
Get
Dim lista As List(Of ElementosEnumerados) = Enumerados.RecuperarEstadosAbonos()
Return lista
End Get
End Property

2.
<ext:ComboBox ID="comboEstadoAsignacionIndividual" runat="server" AllowBlank="false" Editable="false">
</ext:ComboBox>

and


Dim lista As List(Of ElementosEnumerados) = Enumerados.RecuperarEstadosAbonos()

For Each estado In lista
comboEstadoAsignacionIndividual.Items.Add(New Ext.Net.ListItem(estado.Descripcion, estado.Valor))
Next


Any help??

Thanks again.

Daniil
Aug 20, 2013, 2:30 PM
Hi @jamesand,

Please clarify do you need to bind to a ComboBox different data for different rows or the same data for all the rows?

jamesand
Aug 20, 2013, 2:42 PM
The same data to all the rows

Daniil
Aug 20, 2013, 2:56 PM
1. Store's Data. What kind of data you are binding? What is the ElementosEnumerados? Are you able to provide us with a runnable test case? Please try to remove ArrayReader.

2. ComboBox's Items. Where do you execute this code?

comboEstadoAsignacionIndividual.Items.Add(New Ext.Net.ListItem(estado.Descripcion, estado.Valor))

Page_Load or DirectEvent?

jamesand
Aug 20, 2013, 4:28 PM
Daniil I don't know how but I fixed it... I just changed the way another combobox got the data and then it worked.... Really weird.

Thank you anyway.