Mar 07, 2014, 2:28 PM
[CLOSED] How do you dynamically create and populate a copy of a store in code-behind ?
Consider the simple store "stoUser" below that is loaded with data.
<ext:Store ID="stoUser" runat="server" >
<Model>
<ext:Model ID="modUser" runat="server">
<Fields>
<ext:ModelField Name="FirstName" />
<ext:ModelField Name="LastName" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
I need to dynamically create a copy of this store in code-behind and copy the data. This is something we were able to in Ext.Net v1. Below is the code I am trying to get to work; var stoCopy = new Ext.Net.Store();
stoCopy.ID = "stoCopy";
stoCopy.ClientIDMode = ClientIDMode.Static;
var modCopy = new Ext.Net.Model();
modCopy.ID = "modCopy";
modCopy.ClientIDMode = ClientIDMode.Static;
foreach (ModelField fld in stoUser.Model[0].Fields)
{
modCopy.Fields.Add(fld);
}
stoCopy.Model.Add(modCopy);
stoCopy.Listeners.BeforeLoad.Handler += "App.stoCopy.data = App.stoUser.data.clone();";
Controls.Add(stoCopy);
Last edited by Daniil; Mar 09, 2014 at 2:42 PM.
Reason: [CLOSED]