jQuery UI Widgets › Forums › TreeGrid › When Uncheck its goes loop.
Tagged: treegrid control
This topic contains 5 replies, has 2 voices, and was last updated by Peter Stoev 9 years, 10 months ago.
-
Author
-
Hey,
My Code:$(document).on(“rowUncheck”, “#divEmployeeTreeGrid”, function (event) {
debugger
var args = event.args;
var row = args.row;
uncheck(a);
serchCriteriaEmployeeTreeArray.pop(row.EmployeeCode);
});
function uncheck(a) {
debugger
for (var i = 0; i < a.length; i++) {
$(“#divEmployeeTreeGrid”).jqxTreeGrid(‘uncheckRow’, a[i].EmployeeCode);
}}
problem:
When First time uncheck function is call its uncheck but after that this event will call $(document).on(“rowUncheck”, “#divEmployeeTreeGrid”, function (event) and again uncheck function will call and a[i].EmployeeCode will remain same so uncheck will work only one time so parent and its only 1st child wil uncheck and uncheck will not work properly.
please suggest what should i do for uncheck by existing array.
Regards,
Alien K.Hello Alien,
You should never call uncheckRow within rowUncheck event handler. This leads obviously to loop because uncheckRow method raises rowUncheck event.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
please provide me the alternate how to solve this problem.
thanks in advance,
Regards
Alien kHello Alien k,
I don’t know what you want to do. Calling methods and setting properties depends on you app’s logic. I am just telling you that you shouldn’t call uncheckRow method within rowUncheck event handler because you’ll go into infinite loop i.e A calls B and B calls A and this never ends.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
I just wonna know how to uncheck in treegrid after check in treegrid and this uncheck may or may not at one level(only uncheck one parent’s children) or all level.
Thanks in Advance.
Regards,
Alien K.
Hi Alien,
There’s no built in mechanism. Add some IF’s and Boolean Flags in the event handler and only on certain conditions depending on your app, call uncheckRow.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.