jQWidgets Forums
jQuery UI Widgets › Forums › TreeGrid › Treegrid not displaying data in all columns
This topic contains 1 reply, has 2 voices, and was last updated by Peter Stoev 10 years, 9 months ago.
-
Author
-
Hello forum,
I am trying to populate a tree grid with JSON but only one of my columns shows any data.
This is the structure of my JSON:
[ { "action": "<a src=\"Enquiry/ResponseViewer=?252321\">View</a>", "enquiryId": 252321, "enquirerName": 7, "enquiryType": "E-Mail", "enquiryDate": "2013-09-04T10:01:27.417", "status": "In progress", "problemDescription": "trying another section" } ]
This is my javaScript function for the grid:
function initTreeGrdAllocatedMe(data) { console.log(data); var source = { dataType: "json", dataFields: [ { name: 'action ', type: 'string' }, { name: 'enquiryId ', type: 'number' }, { name: 'enquirerName ', type: 'string' }, { name: 'enquiryType ', type: 'string' }, { name: 'enquiryDate ', type: 'date' }, { name: 'status', type: 'string' }, { name: 'problemDescription ', type: 'string' } ], id: 'enquiryId', localData: data }; var dataAdapter = new $.jqx.dataAdapter(source); // create Tree Grid $("#treeGrid-AllocatedMe").jqxTreeGrid( { width: '100%', source: dataAdapter, filterable: true, filterMode: 'simple', columns: [ { text: 'Action', dataField: 'action' }, { text: 'Enquiry Number', dataField: 'enquiryId' }, { text: 'Enquirer Name', dataField: 'enquirerName' }, { text: 'Enquiry Type', dataField: 'enquiryType' }, { text: 'Enquiry Date', dataField: 'enquiryDate', cellsFormat: 'd' }, { text: 'Status', dataField: 'status' }, { text: 'Section Details', dataField: 'problemDescription' } ] }); }
But when the page loads, the only column which shows any data is the status column. I’ve copied the fields exactly how they are spelt to my dataFields so I don’t understand why it doesn’t show all the data.
Kind regards,
NickHi Nick,
I would suggest you to read the help topics about TreeGrid and take a look at its online demos. The initialization of this widget and especially its data binding requires things which are not present in your code. You should have a hierarchy and should define it in the source object.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.