Jun 09, 2011, 1:39 PM
[CLOSED] Create dynamic columns grid and store.
Hi guys,
Is possible create a dynamic grid?
The columns and rows are unknown.
In control grid the asp.net I set datasource is work well. How do I get the ext grid?
This code below work well in my windows forms application:
I have to do anything dynamic.
Do you have any examples like that? Our any suggestion?
Thanks .
Is possible create a dynamic grid?
The columns and rows are unknown.
In control grid the asp.net I set datasource is work well. How do I get the ext grid?
This code below work well in my windows forms application:
public DataTable MontaColunasGrid(List<documento> documentos)
{
DataTable dt = new DataTable();
dt.Columns.Add("id");
//Monta Coluna
foreach (var doc in documentos)
{
foreach (var item in doc.documento_indice)
{
if (!dt.Columns.Contains(item.indice.nome))
dt.Columns.Add(item.indice.nome);
}
}
foreach (var doc in documentos)
{
var i = 1;
DataRow row = dt.NewRow();
row[0] = doc.id;
foreach (var item in doc.documento_indice)
{
row[i] = item.valor;
i++;
}
dt.Rows.Add(row);
}
return dt;
}
Populate store ext: [DirectMethod]
public void PreencheStoreDocumento(List<documento> documentos)
{
Store storeDocumento = this.GridPanelDocumento.GetStore();
storeDocumento.DataSource = MontaColunasGrid(documentos);
storeDocumento.DataBind();
}
My problem is in the store I have defined the columns. I have to do anything dynamic.
Do you have any examples like that? Our any suggestion?
Thanks .
Last edited by Daniil; Jun 10, 2011 at 7:16 PM.
Reason: [CLOSED]