View Full Version : Create GridPanel \ Store from configuration string (reverse of .ToConfig)

Sep 13, 2011, 3:52 PM
For a dynamic UI project that is being built, we are looking into being able to persist the configuration of GridPanels and the related Stores (without data) in a database. The desired solution would be to be able to store these configurations as strings. There is a very clear "ToConfig" method on both the Store and the GridPanel, but it is unclear on how to create a Store or GridPanel from the persisted strings that come out of the .ToConfig methods. We've been unable to find anything in the forums relating to this type of "rehydration" from a string, the dynamic samples use For loops to create Store RecordFields \ GridPanel Columns.

Can somebody point us in the right direction on how to do this? Below are the string configurations from the .ToConfig methods of the sample Store and sample GridPanel that we are using.

Thanks in advance for any assistance that can be provided.

{proxyId:"Store1",autoLoad:true,reader:new Ext.data.JsonReader({fields:[{name:"Col1"},{name:"Col2"},{name:"Col3"},{name:"Col4"}]}),directEventConfig:{},proxy:new Ext.data.PagingMemoryProxy({})}

{store:this.Store1=new Ext.ux.data.PagingStore({proxyId:"Store1",autoLoad:true,reader:new Ext.data.JsonReader({fields:[{name:"Col1"},{name:"Col2"},{name:"Col3"},{name:"Col4"}]}),directEventConfig:{},proxy:new Ext.data.PagingMemoryProxy({})});,id:"419ade80_5970_45e0_be14_7286f542f0fb",xtype:"netgrid",fieldLabel:"GridPanel Test",height:200,selectionMemory:false,cm:this.id5b1d8f 92285a4abbad5e53248d01d5f1=new Ext.grid.ColumnModel({proxyId:"",columns:[{dataIndex:"Col1",header:"Col1 Hdr",id:"Col1"},{dataIndex:"Col2",header:"Col2 Hdr",id:"Col2",width:125},{dataIndex:"Col3",header:"Col3 Hdr",id:"Col3",width:150},{dataIndex:"Col4",header:"Col4 Hdr",id:"Col4",width:200}]})}

Sep 13, 2011, 4:39 PM

If I correctly understood you have a GridPanel instance.

If so, you can just use the GridPanel .ToScript() and the ResourceManager's .AddScript() methods.


this.ResourceManager1.AddScript(gridInstance.ToScr ipt());

But I don't think you need to use .AddScript() if you have a GridPanel instance.

Can you clarify: do you have just a GridPanel config string and don't you use .ToConfig() method in your real application, right?

If so, you just need to create a respective creation script like:

new Ext.net.GridPanel(yourGridConfig);
and use the .AddScript() method.

Please don't forget to add 'renderTo' config option to a grid config.

Sep 13, 2011, 4:44 PM
Unfortunately, there is no working mechanism to automatic deserialize json string to server side widget

Sep 13, 2011, 10:15 PM
Thanks for the quick answers. Would this be a feature that could be added to a wish list of future enhancements or would there be a potential plugin or sample somewhere which might point us in the right direction of implementing on our own?

Sep 14, 2011, 4:49 PM
This something that we have contemplated since the inception of Ext.NET, although has yet to be implemented. Its theoretically possible, although difficult.

We will add as an official Feature Request, although there would be no time-line for implementation.

Sep 14, 2011, 4:51 PM
A Feature Request ticket has been created, see


Edit: Moving thread to Feature Requests forum.