mardi 28 octobre 2014

Check Tree not displaying data

Hi Guys

I am using Ext JS 4.2 and I am trying to make a check tree.


The problem that I am having is that no data is being displayed in my tree:


check tree empty.png

So far I got the following code:


The data:



Code:



var treeSelectedData = {
"wurzel": {
"text": 'New Top Node',
"checked": "null",
"expanded": "true",
"children": [
{
"name": "Inbox",
"id": "Inbox",
"children": [
{
"id": "OfficeInbox",
"name": "RetailInbox",
"checked": "true"
},
{
"id": "bw",
"name": "BusinessWarehouse",
"checked": "false"
},
{
"id": "OphNew",
"name": "AppliedOpeningHours",
"checked": "false"
},
{
"id": "Intranet",
"name": "Intranet",
"checked": "false"
}
]
},
{
"name": "Outbox",
"id": "Outbox",
"children": [
{
"id": "retailOutbox",
"name": "retailOutbox",
"checked": "false"
},
{
"id": "ophApproved",
"name": "ophApproved",
"checked": "false"
},
{
"id": "ophRejected",
"name": "ophRejected",
"checked": "false"
}
]
},
{
"name": "Test",
"id": "Test",
"children": [
{
"id": "Hr",
"name": "Hr",
"checked": "false"
},
{
"id": "WorkReports",
"name": "WorkReports",
"checked": "false"
}
]
}
]
}
};

The model and store:

Code:



Ext.define('com.ibm.issc.publisher.model.TreeSelectModel', {
extend: 'Ext.data.Model',
fields: ['id', 'name']
});


Ext.define('com.ibm.issc.publisher.store.TreeSelectStore', {
extend : 'Ext.data.TreeStore',
model: 'com.ibm.issc.publisher.model.TreeSelectModel',
autoLoad : true
});


var treeSelectStore = Ext.create('com.ibm.issc.publisher.store.TreeSelectStore',{
data : treeSelectedData,
proxy: {
type: 'memory',
reader : {
type : 'json',
root : 'children'
},
/*writer : {
type : 'json'
}*/
},
sorters: [ {
property: 'name',
direction: 'ASC'
}]
});

The tree panel:

Code:



Ext.define('com.ibm.issc.publisher.admin.CheckTree', {
extend: 'Ext.tree.Panel',
xtype: 'check-tree',

id: 'checkTree',
rootVisible: true,
useArrows: true,
frame: true,
title: 'Check Tree',
width: 500,
height: 500,
store: treeSelectStore
});

I am guessing that my data is somehow wrong or that, I should set the root differently.

I have tried a couple of things but nothing seems to work so far, does anybody have any idea what I might be missing or what I am doing wrong?

Thanks a lot!


Thorsten






Check Tree not displaying data

Aucun commentaire:

Enregistrer un commentaire