Create GridPanel \ Store from configuration string (reverse of .ToConfig)

  1. #1

    Create GridPanel \ Store from configuration string (reverse of .ToConfig)

    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.id5b1d8f92285a4abbad5e53248d01d5f1=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}]})}
  2. #2
    Hi,

    If I correctly understood you have a GridPanel instance.

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

    Example
    this.ResourceManager1.AddScript(gridInstance.ToScript());
    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.
  3. #3
    Unfortunately, there is no working mechanism to automatic deserialize json string to server side widget
    Vladimir Shcheglov
    Sr. Developer
  4. #4
    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?
  5. #5
    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.
    Geoffrey McGill
    Founder & CEO
  6. #6
    A Feature Request ticket has been created, see

    https://extnet.lighthouseapp.com/pro...res/tickets/98

    Edit: Moving thread to Feature Requests forum.
    Geoffrey McGill
    Founder & CEO

Similar Threads

  1. [CLOSED] Changing Grid Store configuration in MVC application
    By Daly_AF in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 18, 2012, 1:41 PM
  2. [CLOSED] Menu.ToConfig() fails in a service
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 13, 2012, 9:29 PM
  3. Store with List of String
    By jigpatel06 in forum 1.x Help
    Replies: 0
    Last Post: Apr 06, 2011, 3:05 PM
  4. Replies: 4
    Last Post: Sep 28, 2010, 4:09 PM
  5. Dynamically create GridPanel and Store
    By whitvanilla in forum 1.x Help
    Replies: 4
    Last Post: Jun 18, 2009, 10:18 PM

Tags for this Thread

Posting Permissions