jQuery UI Widgets Forums TreeGrid When Uncheck its goes loop.

This topic contains 5 replies, has 2 voices, and was last updated by  Peter Stoev 9 years, 10 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • When Uncheck its goes loop. #64704

    AlienKwok
    Participant

    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.

    When Uncheck its goes loop. #64711

    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    When Uncheck its goes loop. #64796

    AlienKwok
    Participant

    Hi Peter,

    please provide me the alternate how to solve this problem.

    thanks in advance,
    Regards
    Alien k

    When Uncheck its goes loop. #64800

    Peter Stoev
    Keymaster

    Hello 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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    When Uncheck its goes loop. #64849

    AlienKwok
    Participant

    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.

    When Uncheck its goes loop. #64871

    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.