jQWidgets Forums
jQuery UI Widgets › Forums › TreeGrid › could not save jqxTreeGrid data to database
Tagged: javascript treegrid, jquery treegrid, treegrid
This topic contains 13 replies, has 2 voices, and was last updated by Monish 9 years, 7 months ago.
-
Author
-
Hi,
I want to save the jqxTreeGrid data to database. I used export data method in jqxgrid, where i convert the data to json and send to class file using ajax. When i follow the same format for jqxTreeGrid, a json file is downloading instead of saving the data to the database table. Kindly help to resolve this with any example if possible.Thanks,
MonishHi Monish,
The Data Export always downloads the file. If you don’t want the file to be downloaded set the fileName to null.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Thanks. I tried now, still its downloading. I used the following export settings
exportSettings : {columnsHeader: true, hiddenColumns: false, serverURL: null, characterSet: null, collapsedRecords: false, recordsInView: true,fileName: null}
And when i do the following:
itemData = $('#reportGrid').jqxTreeGrid('exportData','json');
the alert value of itemData comes as undefined. How to proceed further to save the data to database?
Thanks,
MonishHi Monish,
It works with the current version. Example: http://jsfiddle.net/791dbq6c/. I suggest you to check for errors in your code.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Its working, but the sub rows are not exporting. In your example, it shows the data of hierarchical row alone and not its sub rows. Is there any way to get the sub row data too??
Thanks,
MonishHi,
Even though i set collapsedRecords: true in exportSettings, the sub rows are not added to the exportData. Kindly help.
Thanks,
MonishHi Monish,
It is not possible to change the JSON data export through the API. As you want to export to JSON local variable, why do not you just get the widget’s rows using its getRows method?
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Thanks for the idea. But getRows method returning hierarchy row data alone and not its sub rows. My doubt is, the downloded json file contains both hierarchy and sub rows, when i change the file name to null as u suggested and check it through script alert, it just shows the hierarchy row data alone. Why there is a difference here?? I’m badly stuck here. Kindly help.
Note : collapsedRecords – Boolean value. Determines whether the collapsed records would be included in the export.
collapsedRecords is not making any difference even though value set to true or false in the downloaded file as well as the alert which i’m using.
Thanks,
MonishHi Monish,
getRows returns the hierarchy row which means that it includes the sub rows, too. See the method’s documentation – http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxtreegrid/jquery-treegrid-api.htm
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi,
Could you please help me out with an example??
Thanks,
MonishHi Monish,
The API Documentation about getRows explains how to use the method and what it returns. There is also an example there: http://jsfiddle.net/jqwidgets/wjbL3/
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
I could not understand and don’t know to proceed further. Thanks for the support.
Thanks,
MonishHi Monish,
What did not you understand? The example I sent you shows how to get all rows including the sub rows and it displays them on the Screen when the button is clicked. It uses a Recursive function to traverse the result of getRows because getRows returns a Hierarchy, not a Flat set of records. Each member of getRows is documented in the API. jqxTreeGrid is a Hierarchical widget and it works with hierarchies, not with flat data so it is normal that it would return a Hierarchy, not a flat set of records. jqxGrid on the other hand is not a Hierarchical widget and that is why its getRows method returns a Flat set of records and not a Hierarchy.
Hope this helps.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
I just now read your post. In the meantime, i was trying the exact same thing you mentioned in the previous post. I used the traverse to get rows and pushed the data to an array and got the result i was expecting. I really appreciate your patience on me and guiding to get my result. Thank you very much Peter.
Thanks,
Monish -
AuthorPosts
You must be logged in to reply to this topic.