Tagged: collapse treegrid events, expand
Greetings.
We are using TreeGrid with the “adjacency” model and have additional (child) rows loaded on demand via Ajax.
Can you suggest a way to dynamically adjust the width of the leading column to account for indentation?
Compared to your example (http://www.guriddo.net/demo/treegridjs/) our Employee column contains just numbers like 1, 2, 3…
We’d like to increase this column width as additional levels are shown and further decrease the width as levels are collapsed.
Hello Vladimir,
With the current implementation this is very difficult to be done.
This is very interesting feature and we will try to create the appropriate code for this Monday 27 April.
We will let you known.
Just to know – the column will be resized not automatically, but with a width defined from you – auto width is very difficult to be implemented.
Kind Regards,
Will
Guriddo Support Team
Thank you for the response Will,
Yes, auto-resize sounds like what’s needed.
We managed to achieve this with a TreeGrid that has all the “child” rows loaded on page load (not on-demand), by binding to the “click” event of the “.tree-minus” and “.tree-plus” elements, and manually calculating and setting the width based on the highest level in the grid.
Since we have pretty large data tables, we need to load child rows on-demand.
The problem with the above technique and on-demand loading is that we are unable to attach to “.tree-minus” and “.tree-plus” elements outside of an event that gets called every time a row is expanded (like jqGridAfterLoadComplete), resulting in the width adjustment function getting called multiple times for a single click and giving the wrong result.
Unfortunately calling something like:
$(“body”).on(“click”, “.tree-plus, .tree-minus”, function() { doStuff() });
outside a TreeGrid event doesn’t work.
We are also unable to call .off() before .on(), in the event, since that removes your internal code for actually expanding and loading child rows via Ajax.
Sorry for bad formatting. I’m not sure how you add a break with this editor.
Sorry for bad formatting. I’m not sure how you add a break with this editor.
Switch to visual mode (upper right corner) in order to put line breaks
Kind Regards,
Will
Guriddo Support Team
… The problem with the above technique and on-demand loading is that we are unable to attach to “.tree-minus” and “.tree-plus” elements outside of an event that gets called every time a row is expanded (like jqGridAfterLoadComplete), resulting in the width adjustment function getting called multiple times for a single click and giving the wrong result.
…
This is exactly what we plan to do – to define a events when the plus or minus icons are clicked.
Kind Regards,
Will
Guriddo Support Team
Sorry for bad formatting. I’m not sure how you add a break with this editor.
Switch to visual mode (upper right corner) in order to put line breaks
Kind Regards,
Will
Thank you.
… The problem with the above technique and on-demand loading is that we are unable to attach to “.tree-minus” and “.tree-plus” elements outside of an event that gets called every time a row is expanded (like jqGridAfterLoadComplete), resulting in the width adjustment function getting called multiple times for a single click and giving the wrong result.
…
This is exactly what we plan to do – to define a events when the plus or minus icons are clicked.
Kind Regards,
Will
Sounds great.
Hello,
We have added a lot of events when expanding/collapsing a tree grid row.
The changes are available in git hub here . We have updated the build, so you can download this addition.
Note that it is possible not to expand/collapse row/node if the events in before action return false.
Please let us know if you have problems with this. If everthing is OK. we plan to add this requirement in our new Knowledge base
Kind Regards,
Will
Guriddo Support Team
Great. Thank you for the prompt addition.
Will let you know how it goes.
Hello Will,
the events are working great. Could you just tell me what’s the proper way to set the column width dynamically?
So far I have been just using CSS, but then
$(“#grid”).trigger(“resize”)
ignores the new width. I have tried with
$(“#grid”).jqGrid(‘setColProp’, ‘position’, { widthOrg: newWidth, width: newWidth });
but that results in a larger width than expected.
I saw there’s a plugin for this by Oleg: https://github.com/OlegKi/jqGrid-plugins/blob/master/jQuery.jqGrid.setColWidth.js
Should I maybe use that plugin?
Thank you!
Hello,
We will add this method (or similar) in the base of the grid module.
We will let you know.
Thanks for sharing.
Kind Regards,
Will
Guriddo Support Team
That would be amazing! Thank you.
Hello,
We have added a resizeColumn method in GitHub
You can download it from the GitHub build.
Please let us know if you encounter problems with this.
Kind Regards,
Will
Guriddo Support Team
Greetings,
Sorry for a late response, I was on a short vacation.
Thank you for adding the resizeColumn method, it works great!
Cheers!
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top