extjs - Json data is not populated in treeview panel -
here below json formate need show in treeview panel in extjs6 after loading store server not able see records in tree panel. should model view , store json rendering in tree view panel . thanks. here code :
model :
ext.define('file', { extend: 'ext.data.treemodel', fields: [ {number: 'number', type: 'string'}, ] });
store :
var store = ext.create('ext.data.treestore', { model: 'file', proxy: { type: 'ajax', url: 'component-tree.json', reader: { type: 'json', rootproperty: 'components', leaf: true, children: 'components', expanded: true, }, }, foldersort: true, });
view :
var tree = ext.create('ext.tree.panel', { autoload: true, collapsible: true, usearrows: true, rootvisible: true, store: store, multiselect: true, width: 250, height: 300, viewconfig: { plugins: { ptype: 'treeviewdragdrop', appendonly: true } }, root: { text: "components", expanded: true, }, renderto: document.body });
component-tree.json :
{ "components": { "state": "released", "nodetype": "component", "checked": true, "name": "plate - cabinet - assembly", "level": 0, "url": "http://example.com/windchill/servlet/nexiles/tools/api/1.0/epmdocuments/or:wt.epm.epmdocument:4474031", "oid": "or:wt.epm.epmdocument:4474031", "modified": "17.04.2015", "filename": "21378386.asm", "num_children": 7, "number": "21378386.asm", "details": "http://example.com/windchill/app/#ptc1/tcomp/infopage?oid=or:wt.epm.epmdocument:4474031&u8=1", "components": [ { "nodetype": "component", "leaf": true, "name": "plate - cabinet - detail", "level": 1, "url": "http://example.com/windchill/servlet/nexiles/tools/api/1.0/epmdocuments/or:wt.epm.epmdocument:4474018", "oid": "or:wt.epm.epmdocument:4474018", "modified": "17.04.2011", "filename": "1234.prt", "state": "released", "number": "21378385.prt", "details": "http://example.com/windchill/app/#ptc1/tcomp/infopage?oid=or:wt.epm.epmdocument:4474018&u8=1", "version": "a", "checked": true, "drawings": [ { "reftype": "drawing", "nodetype": "drawing", "leaf": true, "name": "plate - cabinet - detail", "url": "http://example.com/windchill/servlet/nexiles/tools/api/1.0/epmdocuments/or:wt.epm.epmdocument:4474013", "oid": "or:wt.epm.epmdocument:4474013", "modified": "17.04.2015", "filename": "21378385.drw", "source": "representation", "state": "released", "number": "21378385.drw", "details": "http://example.com/windchill/app/#ptc1/tcomp/infopage?oid=or:wt.epm.epmdocument:4474013&u8=1", "version": "a", "checked": true, "id": "or:wt.epm.epmdocument:4474013-drawing", "icon": "/resources/images/drawing.gif" }, { "reftype": "internal", "nodetype": "drawing", "leaf": true, "name": "plate - cabinet - assembly", "url": "http://example.com/windchill/servlet/nexiles/tools/api/1.0/epmdocuments/or:wt.epm.epmdocument:4474041", "oid": "or:wt.epm.epmdocument:4474041", "modified": "17.04.2015", "filename": "21378386.drw", "source": "representation", "state": "released", "number": "21378386.drw", "details": "http://example.com/windchill/app/#ptc1/tcomp/infopage?oid=or:wt.epm.epmdocument:4474041&u8=1", "version": "a", "checked": true, "id": "or:wt.epm.epmdocument:4474041-internal", "icon": "/resources/images/drawing.gif" } ], "icon": "/resources/images/prt_image.gif" } }
your treemodel defines
number
store contains more fields...take @ the doc in chapter 'heterogeneous node types' more information.
try
children
instead ofcomponents
in json file. way remark case not respected between configurationroot: { text: "components", ... }
, json content"components": [ ... ]
.
c
,c
Comments
Post a Comment