Code:
Ext.define('Sencha.view.BomDataNestedList',{
extend: 'Ext.NestedList',
xtype: 'xBomDataNestedList',
requires: ['Sencha.store.storeBomDataNested'],
config: {
//title: 'Groceries',
useTitleAsBackText: false,
displayField: 'ItemId} {ItemId',
store: 'storeBomDataNested',
fullscreen: true,
width:'100%',rootVisible: false,
height:'100%',
top: 0, right:0, left: 0,
border: 100, updateTitleText: false,
docked: 'top', defaultRootProperty: '',
toolbar:{ xtype: 'toolbar',
docked: 'top',
items: [
{
//iconCls: 'list',
//iconMask: true,
ui: 'plain',
action: 'showSearch',
style: 'background: transparent url(\'res/images/home1.png\') no-repeat;',
},
{
xtype: 'spacer'
},
{
xtype: 'label',
html: 'Bill of Material View',
width: '33%',
height: '100%'
},
{
xtype: 'spacer'
},
{
//iconCls: 'setting',
//iconMask: false,
ui: 'plain',
action: 'showSetting',
style: 'background: transparent url(\'res/images/settings.png\') no-repeat;',
}
]}
}
});
modelBomDataNestedList.js
Code:
Ext.define("Sencha.model.modelBomDataNestedList", {
extend: "Ext.data.Model",
config: {
//idProperty: 'id',
fields: [
{name: 'URMIL', type: 'string'},
{ name: 'PD_Name', type: 'string' },
{ name: 'Description', type: 'string' },
{ name: 'ItemId', type: 'string' },
{ name: 'ParentId', type: 'string' },
{ name: 'children', },
hasMany: {
name: 'Children',
model: 'Sencha.model.Children'
},
proxy: {
type: 'ajax',
url: 'BOMData.json',
reader : {
type : 'json',
rootProperty : 'URMIL'
}
},
}
});
Ext.define('Sencha.model.Children', {
extend: 'Ext.data.Model',
fields: [
{ name: 'PD_Name', type: 'string' },
{ name: 'Description', type: 'string' },
{ name: 'ItemId', type: 'string' },
{ name: 'ParentId', type: 'string' },
],
belongsTo: 'Sencha.model.modelBomDataNestedList'
});
storeBomDataNested.js
Code:
[
{
"PD_Name": "MPL-270T473",
"Description": "LSP-KENDALL",
"ItemId": "001",
"ParentId": "0",
"children": [
{
"PD_Name": "CPD-M000",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "002",
"ParentId": "001",
"children": [
{
"PD_Name": "CPD-001",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "003",
"ParentId": "002",
"children": [
{
"PD_Name": "CPD-S001",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true",
"ItemId": "004",
"ParentId": "003"
},
{
"PD_Name": "CPD-S002",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true",
"ItemId": "005",
"ParentId": "003"
},
{
"PD_Name": "CPD-S003",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true",
"ItemId": "006",
"ParentId": "003"
},
{
"PD_Name": "CPD-S004",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true",
"ItemId": "007",
"ParentId": "003"
},
{
"PD_Name": "CPD-S005",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true",
"ItemId": "008",
"ParentId": "003"
},
{
"PD_Name": "CPD-S006",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true",
"ItemId": "009",
"ParentId": "003"
},
{
"PD_Name": "CPD-S006",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true",
"ItemId": "010",
"ParentId": "003"
},
{
"PD_Name": "CPD-S007",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true",
"ItemId": "011",
"ParentId": "003"
}
]
},
{
"PD_Name": "CPD-002",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "012",
"ParentId": "002",
"children": [
{
"PD_Name": "CPD-SS001",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "013",
"ParentId": "012",
"leaf": "true"
},
{
"PD_Name": "CPD-SS001",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "014",
"ParentId": "012",
"leaf": "true"
}
]
}
]
},
{
"PD_Name": "CPD-M001",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "015",
"ParentId": "001",
"children": [
{
"PD_Name": "CPD-S001",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "016",
"ParentId": "015",
"leaf": "true"
},
{
"PD_Name": "CPD-S002",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "017",
"ParentId": "015",
"leaf": "true"
},
{
"PD_Name": "CPD-S002",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "018",
"ParentId": "015",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "019",
"ParentId": "015",
"leaf": "true"
}
]
},
{
"PD_Name": "CPD-M002",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "020",
"ParentId": "001",
"children": [
{
"PD_Name": "CPD-001",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "021",
"ParentId": "020",
"children": [
{
"PD_Name": "CPD-S003",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "022",
"ParentId": "021",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"ItemId": "023",
"ParentId": "021",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"ItemId": "024",
"ParentId": "021",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"ItemId": "025",
"ParentId": "021",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"ItemId": "026",
"ParentId": "021",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
}
]
},
{
"PD_Name": "CPD-001",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "027",
"ParentId": "020",
"children": [
{
"PD_Name": "CPD-S003",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "028",
"ParentId": "027",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "029",
"ParentId": "027",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "030",
"ParentId": "027",
"leaf": "true"
}
]
}
]
},
{
"PD_Name": "CPD-M003",
"Description": "CONSTR PRINT DOCUMENTS",
"ItemId": "031",
"ParentId": "001",
"children": [
{
"PD_Name": "CPD-S003",
"ItemId": "032",
"ParentId": "031",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"ItemId": "033",
"ParentId": "031",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"ItemId": "034",
"ParentId": "031",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"ItemId": "035",
"ParentId": "031",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"ItemId": "036",
"ParentId": "031",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"ItemId": "037",
"ParentId": "031",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"ItemId": "038",
"ParentId": "031",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"ItemId": "039",
"ParentId": "031",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
},
{
"PD_Name": "CPD-S003",
"ItemId": "040",
"ParentId": "031",
"Description": "CONSTR PRINT DOCUMENTS",
"leaf": "true"
}
]
}
]
}
]
Stuck Big Time! Need Help! Thanks