-
Unanswered: How to add record to Complex Store
Unanswered: How to add record to Complex Store
How can we add record to a complex store.
Ext.regModel("model", {
fields: [
"Department",
"Pic",
{ name: "Employee", type: "auto" }
]
});
Store = new Ext.data.Store({
model: "model",
}
});
Store.add(//DepartmentName);
Store.getAt(0).set('Employee",//Employee record);
This one works.
But if i try to add new Employee record again at index 0 it replaces old employee
How can i add multiple Employee at index 0 of Store?
-
Sencha - Senior Forum Manager
Store.insert accepts an index as it's first argument.
-
Am doing this which works fine, but am using same store in Xtemplate on other view where i cant see data coming.
if(Store.getAt(0).data.Employee=== undefined)
{
Store.getAt(0).set("Employee",[ rec.data]);
}
else
{
Store.getAt(0).data.Employee.push(rec.data);
{
'<tpl for=".">',
'<tpl for="Employee">',
'{Name}',
'</tpl>',
'</tpl>'
Do you have any other method to do that as Employee field can have multiple objects.
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us