jQWidgets Forums
jQuery UI Widgets › Forums › TreeGrid › adding rows to target grid
Tagged: treegrid, treegrid component
This topic contains 3 replies, has 2 voices, and was last updated by Peter Stoev 10 years, 10 months ago.
-
Author
-
Hi
Below is my POC.
There are two tree grids. One is source treegrid and another is target treegrid.
The user checks/selects some rows in the source treegrid and then clicks on a button “transfer”. Then all checked/selected rows should be transferred to the target treegrid.
I tried adding selected rows to target grid. They are getting added (still fine things have to be checked).
The problem i am facing is: after adding to the target grid, if i check the rows length of the target grid,
console.log("trying to get the added row: "+ $("#tablesTreeGrid_target").jqxTreeGrid('getRows').length);
, it gives me zero.It is very much required for me when i transfer child rows before transferring parent row. Here, i am trying to add parent row first, then retrieve it using getRow method. I am failing here. This is stopping me to add child rows as child rows.
Why is it happening? It is the same case with checked usage. Should i commit/save some indicators?
…..Radha
Hi Radha,
The “getRows” method returns an Array of Records. Each record may have or may not have records property as specified in the Documentation. You should think about “getRows” as something which returns a Hierarchy, not a simple Flat list. That is so because jqxTreeGrid is Hierarchical Grid, not Flat Table. To add row, you can use the “addRow” method. Example: http://jsfiddle.net/jqwidgets/rkttb/
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter
Looks like “addRow” method does not support hierarchies. Using checked option, the entire parent (with children) moves but does not support adding to existing parent. If i use use “selection” option, the parent does not move with children. Even if we add children to parent, the children are ignored while adding to target.
I have tried adding event.args.row directly & extract content from event.args.row and add as {‘<content>’}. Both did not work.
Now, i am trying to recreate the whole target grid every time when the user tries to move rows!!
Any suggestions are welcome.
thanks, Radha
Hi Radha,
Check out this demo: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxtreegrid/javascript-tree-grid-inline-editing.htm?arctic. So taking into account the fact that you can Add a Row to a Parent or Child means that addRow method supports Hierarchies when it is used in the documented way. The expected argument value is a JSON object with your dataFields and Cell Values, not an Event Argument. Unfortunately, moving rows is not supported, too.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.