jQWidgets Forums
jQuery UI Widgets › Forums › TreeGrid › How to expand all rows in jqxTreeGrid
Tagged: expandRow, jqxTreeGrid expand rows
This topic contains 10 replies, has 6 voices, and was last updated by Peter Stoev 9 years, 9 months ago.
-
Author
-
How can I expand all rows in a TreeGrid?
When I use getRows, it only returns the top level rows.
Hi yougotnet,
getRows returns a hierarchy of rows i.e it returns all rows in hierarchical manner i.e a row may have sub rows, etc. It will not return a flat list. If there’s a sub row, it will be stored in member, called records. At present, there’s no API for expanding/collapsing all rows. We will consider adding such API in future versions.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Here is the code to expand all the rows:
ready: function() // Expanding all rows (parent and its sub-lings)
{
var rows = $(“#treeGrid”).jqxTreeGrid(‘getRows’);
var traverseTree = function(rows)
{
for(var i = 0; i < rows.length; i++)
{
if (rows[i].records)
{
idValue = rows[i][idColumn];
$(“#treeGrid”).jqxTreeGrid(‘expandRow’,idValue);
traverseTree(rows[i].records);
}
}
};
var idColumn = $(“#treeGrid”).jqxTreeGrid(‘source’)._source.id;
traverseTree(rows);
}if tree with 2 levels you can do this:
var rows = $(“#treeGrid”).jqxTreeGrid(‘getRows’), for(var i=1;i <= rows.length; i++){ $(“#treeGrid”).jqxTreeGrid("expandRow",rows[i-1].UNIQUEID); }
@ Peter Stoev : Please let me know if there is any API for expand rows future at this point of time .
Hi arunkumar.rc,
API is available on: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxtreegrid/jquery-treegrid-api.htm
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Thank you Peter!
When I use this method , I am getting below error . Not sure what I am missing , I tried by including seperate jqx reference files instead of jqx-all.js. Functions like export is working perfectly fine.
collapseAll as well not working . Any help will be appreciated. I am using version 3.8.2
jqxCore: Invalid parameter ‘[expandAll]’ does not exist.
jqx-all.js, line 7 character 5478Peter , Ignore my previous post . Actually I was using 3.8.0.
Updated my js files to 3.8.2 and it works like a charm . Thanks again for your quick response !Hi arunkumar.rc,
expandAll/collapseAll are available since 3.8.2 and not available in previous versions. Information: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/releasehistory/releasehistory.htm
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter.
Do you know why the expandAll renders the checkboxes of the children nodes with a black square?
For example: http://jsfiddle.net/yw02cpwe/3/Best regards,
Gerasimos
Hi Gerasimos,
We will investigate that.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.