extjs - Sencha Touch insert item into TreeStore / NestedList -
is there way insert new record treestore?
treestore data source of nestedlist, @ end point need add new item nestedlist
here example https://fiddle.sencha.com/#fiddle/4f4
var datastore; var dataobj; ext.application({ name: 'testapp', launch: function() { // data dataobj = { items: [ { field1: '1', items: [{ field1: '1.1', items: [{ field1: '1.1.1 last', leaf: true }, { field1: '1.1.2 last', leaf: true }] }, { field1: '1.2 last', leaf: true }] }, { field1: '2', items: [{ field1: '2.1 last', leaf: true }, { field1: '2.2 last', leaf: true }] } ] } // model ext.define('datamodel', { extend: 'ext.data.model', config: { fields: [ {name: 'field1', type: 'string'}, ] } }); // treestore datastore = ext.create("ext.data.treestore", { storeid: "usersstore", model: "datamodel", defaultrootproperty: 'items', data : dataobj }); // nestedlist , display ext.create('ext.nestedlist', { fullscreen: true, displayfield: 'field1', store: datastore }); } });
similar threads: sencha touch 2: insert treestore/nestedlist
thanks!
store binded nestedlist, add new data store.
dataobj.items.push({ field1: '3', items: [{ field1: '3.1 last', leaf: true }, { field1: '3.2 last', leaf: true }] }); datastore.setdata(dataobj);
Comments
Post a Comment