I am trying to create a tree grid that results in a tree that looks like this.
group1 total-logins
---user1 logins
---user2 logins
group2 total - logins
---user3 logins
---user4 logins
I have a treegrid pointed to a datasource set up which retrieves a flat list of xml
So what I tried to do was use transformresponse to create a new data array so I can create the group rows with totals. The array members are group rows with a children array of user rows. Then I pass back the new array as the dsresponse.data. However the tree grid does not interpret the parent child relationship..it just puts each node as a child of the previous node regardless of if it is part of the .children or not.
Could you point me in the right direction please.
group1 total-logins
---user1 logins
---user2 logins
group2 total - logins
---user3 logins
---user4 logins
I have a treegrid pointed to a datasource set up which retrieves a flat list of xml
Code:
isc.TreeGrid.create({
ID: "GroupTreeGrid",
autoFetchData: false,
dataSource: "userDS",
loadDataOnDemand: false,
openerImage: null,
nodeIcon: "../images/u.png",
folderIcon: "../images/gp_16.png",
fields: [...]
})
isc.DataSource.create({
ID: "usersDS",
dataURL: "..."
recordXPath: "//row",
transformResponse: function(dsResponse, dsRequest, data) {
return buildGroupData(dsResponse, dsRequest, data, null);
},
fields: [
{ title: "Name", name: "name"},
{ title: "Logins", name: "logins"},
],
});
My XML
<dataSet>
<row>
<groupId>1</groupId>
<userId>1111111</userId>
<logins>5</logins> <name>John</name>
</row>
<row>
<groupId>1</groupId>
<userId>1222222</userId>
<logins>3</logins> <name>Joe</name>
</row>
<row>
<groupId>2</groupId>
<userId>13333</userId>
<logins>5</logins> <name>Jake</name>
</row>
<row>
<groupId>2</groupId>
<userId>1444444</userId>
<logins>3</logins> <name>Tom</name>
</row>...etc
Could you point me in the right direction please.
Comment