jQuery UI Widgets › Forums › TreeGrid › Dynamic Creation of Tree Grid based on Database Return
Tagged: treeGrid dynamic
This topic contains 1 reply, has 2 voices, and was last updated by ivailo 9 years, 6 months ago.
-
Author
-
I want to create the tree grid with a source data that gets generated once a user submits a name on a Django Form.
Once the database makes the record, I send data back to the page in order for that to use the source of the Tree Grid.
How can I get the grid to show up in my form with this data? Everything seems to be correct since the data comes back and the Datasource gets set. The problem is the Grid doesn’t show up. Do I need to call something on the constructor?
Here is the ajax call:
$(document).ready(function () { var data = '[{}]'; var dataAdapter; $(".form-inline").submit(function (e) { // catch the form's submit event e.preventDefault(); $.ajax({ // create an AJAX call... data: $(this).serialize(), // get the form data dataType: "json", type: $(this).attr('method'), // GET or POST url: $(this).attr('action'), // the file to call success: function (json) { // on success.. var data = { localdata: JSON.parse(json), //data received from server datatype: 'array' }; dataAdapter = new $.jqx.dataAdapter(data); dataAdapter.dataBind(); $("#treeGrid").jqxTreeGrid( { source: dataAdapter, }); console.log(data) }, error: function (e, x, r) { // on error.. $("#error").html(e); // update the DIV } }); });
Hi axwack,
You have to initialize correctly your jqxTreeGrid.
This demo will be helpful for you.Best Regards,
Ivailo IvanovjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.