PDA

View Full Version : [CLOSED] DataGrid only rendering partial values ( version 2.2)



Pyropace
Mar 23, 2013, 7:45 PM
Hello All,

I have a DataGrid with Livesearchplugin as follows



Html.X().GridPanel().ID("wsGridPanel").Height(500)
.Store(Html.X().Store().ID("wsGridStore").Model(Html.X().Model()))
.Plugins(Html.X().LiveSearchGridPanel())
.TopBar(Html.X().LiveSearchToolbar()
.Items(Html.X().Button()
.Text("Search")
.ToolTip("Yellow highlight")
.IconCls("x-yellow-highlight")
.Pressed(true)
.EnableToggle(true)
.ToggleGroup("highlightColor")
.ToggleHandler("function(b, state) {if(state) {this.up('wsGridPanel').liveSearchPlugin.matchCls = 'x-livesearch-match';}}")


The following Code reconfigures and resets the the datagrid based on a datatable



// recreate columns
foreach (DataColumn dsColumn in dataTable.Columns)
{
ModelField field = new ModelField(dsColumn.ColumnName, ModelFieldType.Auto);
store.AddField(field);

Column newCol = new Column
{
Text = dsColumn.ColumnName,
DataIndex = dsColumn.ColumnName,
Sortable = true
};

if (dsColumn.ColumnName.ToLower().Contains("amount"))
{
newCol.Renderer.Fn = "moneyColorRenderer";
}
else
{
if (dsColumn.ColumnName.ToLower().Contains("date"))
{
newCol.Renderer.Format = RendererFormat.Date;
}
}

wsGridPanel.AddColumn(newCol);

for (int i = 0; i < dataTable.Rows.Count; i++)
{
store.LoadData(dataTable.Rows[i].ItemArray, false);
}

}

return this.Direct();
}


This method uses the following DataModel


public class DataModel
{

[Display(Name = "Method")]
public string SelectedTableValue { get; set; }

public int SelectedService { get; set; }
}


When the page is loaded and executed, we can see the method is returning the new configuration and data as image "DataGrid" shows

5900

However the Grid doesnot render the values as shown here
5898

However other times it does render portion of data as shown here
5899

I am not sure what is going wrong, no js errors are thrown.

Any help is appreciated

Thanks
Amir

Pyropace
Mar 25, 2013, 1:07 AM
Hi Guys,

It has been longer than 24 hours, has any one had a chance to take alook this ?

Thanks

Daniil
Mar 25, 2013, 5:32 AM
Hi @Pyropace,

Apologize for the delay.

The LoadData method expects a set (e.g. an array or a list) of objects.

If you use an ArrayReader, it should be a set of arrays. Each array represents data for a row.

If a JsonReader - a set of objects. Each object represents data for a row.

You could try to replace

for (int i = 0; i < dataTable.Rows.Count; i++)
{
store.LoadData(dataTable.Rows[i].ItemArray, false);
}
with

store.LoadData(dataTable, false);

Pyropace
Mar 25, 2013, 3:03 PM
Hi @Pyropace,

Apologize for the delay.

The LoadData method expects a set (e.g. an array or a list) of objects.

If you use an ArrayReader, it should be a set of arrays. Each array represents data for a row.

If a JsonReader - a set of objects. Each object represents data for a row.

You could try to replace

for (int i = 0; i < dataTable.Rows.Count; i++)
{
store.LoadData(dataTable.Rows[i].ItemArray, false);
}
with

store.LoadData(dataTable, false);


beautiful

Thank you