PDA

View Full Version : nested list not displaying the sub items



akshata
24 Feb 2011, 2:38 AM
Hi,

I have some problem with nested list .
i have a json file with th names of folders and subfolders . My code is able to display the folders but when i click on the folders th subfolder names are not getting displayed..my code is as below

Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function(){
var pnl = new Ext.Panel({
fullscreen: true,
layout: 'fit'
});

Ext.Ajax.request({
url: 'cust7.xml',

success: function(response){

var str = response.responseText ;
str = str.replace(/"/g," ");
var dom = parseXml(str);
var json = xml2json(dom , " ");

json = json.replace(/@/g,"");

//document.writeln(json);
var obj = Ext.decode(json);
//alert(obj);




renderFolders(obj.HiNavTaxonomy.root.category);
},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}
});

var renderFolders = function(data){



Ext.regModel('folders', {
fields: ["categoryDescription","categoryHeader","isApplication","leftSide","letushelp","name","objectID","rightSide","sectionTitle","showChildren","showPeersForDescendents","title","indexPage" [ "entitlement","shortTitle","title","url" ],"sortOrder"
]

});



var store = new Ext.data.TreeStore({
model: 'folders',
root: data,
proxy: {
type: 'ajax',
reader: {
type: 'tree',
//root: 'categories'
}
}
});
var nestedList = new Ext.NestedList({
plugins: [new Ext.LeafSelectedPlugin()],

fullscreen: true,
title: 'back',
displayField: 'name',


store: store

});


}



}
});

and th json file is..


{
"HiNavTaxonomy": {
"version": "132.12",
"root": {
"categoryDescription": "",
"categoryHeader": "Category Header",
"isApplication": "No",
"leftSide": "Inherit",
"letushelp": "",
"name": "tkl",
"objectID": "0b00e4af809d8c1e",
"rightSide": "Inherit",
"sectionTitle": "",
"showChildren": "No",
"showPeersForDescendents": "Yes",
"title": "tkl",
"indexPage": {
"entitlement": "",
"shortTitle": "",
"title": "",
"url": ""
},
"sortOrder": null,
"category": [


{
"categoryDescription": "",
"categoryHeader": "Category Header",
"isApplication": "No",
"leftSide": "Inherit",
"letushelp": "",
"name": "TKLTESTLDAP",
"objectID": "0b00e4af80e444f6",
"rightSide": "Inherit",
"sectionTitle": "",
"showChildren": "No",
"showPeersForDescendents": "Yes",
"title": "TKLTESTLDAP",
"indexPage": {
"entitlement": "",
"shortTitle": "",
"title": "",
"url": ""
},
"sortOrder": null,
"category": {
"categoryDescription": "",
"categoryHeader": "TKLTESTLDAPSUB",
"isApplication": "No",
"leftSide": "Inherit",
"letushelp": "",
"name": "TKLTESTLDAPSUBUP",
"objectID": "0b00e4af80e47e25",
"rightSide": "Inherit",
"sectionTitle": "",
"showChildren": "No",
"showPeersForDescendents": "Yes",
"title": "TKLTESTLDAPSUBUP",
"indexPage": {
"entitlement": "",
"shortTitle": "",
"title": "",
"url": ""
},
"sortOrder": null
}
}
]
}
}
}
Please let me know where i am going wrong....