Dec 08, 2012, 8:39 AM
[CLOSED] RatingColumn and ComponentConfig
Hello All,
I noticed that when I am using RatingColumn then ComponentConfig generates a bit different result. Here is a bit modified code from MVC Examples (Row Expander Plugin with GridPanel):
Thanks,
Alexander
I noticed that when I am using RatingColumn then ComponentConfig generates a bit different result. Here is a bit modified code from MVC Examples (Row Expander Plugin with GridPanel):
public ActionResult GetGrid(string id)
{
List<object> data = new List<object>();
for (int i = 1; i <= 10; i++)
{
data.Add(new { ID = "P" + i, Name = "Product " + i });
}
GridPanel grid = new GridPanel
{
Height = 200,
EnableColumnHide = false,
Store =
{
new Store
{
Model =
{
new Model {
IDProperty = "ID",
Fields = {
new ModelField("ID"),
new ModelField("Name")
}
}
},
DataSource = data
}
},
ColumnModel =
{
Columns =
{
new Column { Text = "Products's Name", DataIndex = "Name" },
new RatingColumn {Text = "asasas" }
}
}
};
return this.ComponentConfig(grid);
}
As you see I just added RatingColumn. After this I got the following JSON:{'x.res':{},config:"[{store:{model:Ext.define(Ext.id(), {extend: \"Ext.data.Model\", fields:[{name:\"ID\"},{name:\"Name\"}],idProperty:\"ID\" }),autoLoad:true,proxy:{data:[{\"ID\":\"P1\",\"Name\":\"Product 1\"},{\"ID\":\"P2\",\"Name\":\"Product 2\"},{\"ID\":\"P3\",\"Name\":\"Product 3\"},{\"ID\":\"P4\",\"Name\":\"Product 4\"},{\"ID\":\"P5\",\"Name\":\"Product 5\"},{\"ID\":\"P6\",\"Name\":\"Product 6\"},{\"ID\":\"P7\",\"Name\":\"Product 7\"},{\"ID\":\"P8\",\"Name\":\"Product 8\"},{\"ID\":\"P9\",\"Name\":\"Product 9\"},{\"ID\":\"P10\",\"Name\":\"Product 10\"}], type: 'memory'}},height:200,xtype:\"grid\",columns:{items:[{dataIndex:\"Name\",text:\"Products's Name\"},{xtype:\"ratingcolumn\",text:\"asasas\"}]},enableColumnHide:false}]"}
However, without RatingColumn JSON will be:[{store:{model:Ext.define(Ext.id(), {extend: "Ext.data.Model", fields:[{name:"ID"},{name:"Name"}],idProperty:"ID" }),autoLoad:true,proxy:{data:[{"ID":"P1","Name":"Product 1"},{"ID":"P2","Name":"Product 2"},{"ID":"P3","Name":"Product 3"},{"ID":"P4","Name":"Product 4"},{"ID":"P5","Name":"Product 5"},{"ID":"P6","Name":"Product 6"},{"ID":"P7","Name":"Product 7"},{"ID":"P8","Name":"Product 8"},{"ID":"P9","Name":"Product 9"},{"ID":"P10","Name":"Product 10"}], type: 'memory'}},height:200,xtype:"grid",columns:{items:[{dataIndex:"Name",text:"Products's Name"}]},enableColumnHide:false}]
As you see the format is absolutely different and the first one component loader can't recognize.Thanks,
Alexander
Last edited by Daniil; Dec 10, 2012 at 4:55 AM.
Reason: Please use [CODE] tags, [CLOSED]