jQWidgets Forums
jQuery UI Widgets › Forums › TreeGrid › treegrid's data format
Tagged: treegrid
This topic contains 2 replies, has 2 voices, and was last updated by bobmazzo 10 years, 8 months ago.
-
Authortreegrid's data format Posts
-
Hi Peter,
My question is regarding the Json data format best suitable for the treegrid widget. I’d basically like to know which method of defining the hierarchy grid data is best in terms of flexibility and scalability. I see both the flat method of formatting the records, as well as the nested children arrays.In other words, the parent/child format in your demo area shows that the parent/child fields are contained within each row (i.e. NOT nested within children arrays) :
var employees = [ { "EmployeeID": 1, "FirstName": "Nancy", "LastName": "Davolio", "ReportsTo": 2 } ] hierarchy: { keyDataField: { name: 'EmployeeID' }, parentDataField: { name: 'ReportsTo' } }
whereas the Columns Hierarchy shows how the nested children array can be formatted – :
ex/
{ "id": "1", "name": "Corporate Headquarters", "budget": "1230000", "location": "Las Vegas", "children": [{},{},{}] }
In the end, is one data format preferred over another ? I need to know so I can format my data accordingly, and subsequently get the best performance out of your grid.
Thank you again for your time.
regards,
Bob
Hello Bob,
You can read about TreeGrid on the documentation page or experience with the samples in order to decide which feature to use and to learn how to use it.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Thank you Peter,
I’ve read through the TreeGrid documentation at http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxtreegrid/jquery-treegrid-data-sources.htm , and especially concentrated on the Data Sources section (‘Data Binding to Nested JSON’ and ‘Data Binding to JSON’).I also have a basic prototype working with nested JSON in my project, and thus far it’s working quite well. Many compliments on your treegrid.
I wanted to know more specifically if there’s a preferred JSON format for the grid (flat JSON vs. nested JSON), but I cannot glean any information from the documentation.
In any case, it might be more efficient to prepare my JSON data in a nested format in order to save the grid additional parsing work. I say that based on this line:
“Items in the data source must contain information on the parent-child relationships. Using this information, the TreeGrid will create records and organize them into a hierarchical structure.”
Anyhow, thanks for your response once again.
best regards,
Bob
-
AuthorPosts
You must be logged in to reply to this topic.