jQWidgets Forums

jQuery UI Widgets Forums Grid How to get row index problem

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  joe cx 10 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • How to get row index problem #65747

    joe cx
    Participant

    Hi All,

    Im new in jqxgrid. I have a problem when i trying to add selectionmode: ‘multiplecellsadvanced’ in this example Create, Remove, Update.

    The problem is button Delete didnt work properly. i think because the getselectedrowindex method, but i dont know what the corect method should be used. Sorry for my bad english 😀

    Thank’s for any reply

    How to get row index problem #65760

    Peter Stoev
    Keymaster

    Hi joe cx,

    In cell selection mode, you should use API for getting selected cells because you don’t have selected row and respectively getselectedrowindex will return most probably -1 because there’s no selected row.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    How to get row index problem #65957

    joe cx
    Participant

    Hi Peter,

    Thank you for the quick reply. I’ve read the documentation & i changed my code like this :

    `var selectedrowindex = -1;

    $(“#jqxgrid”).on(‘cellselect’, function (event) {

    selectedrowindex = event.args.rowindex;
    });

    $(“#removebutton”).on(‘click’, function () {
    var rowscount = $(“#jqxgrid”).jqxGrid(‘getdatainformation’).rowscount;
    if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
    var id = $(“#jqxgrid”).jqxGrid(‘getrowid’, selectedrowindex);
    var commit = $(“#jqxgrid”).jqxGrid(‘deleterow’, id);
    }
    });`

    Am i doing this right ? Thanks again peter.

    Best regards
    Joe

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

You must be logged in to reply to this topic.