jQWidgets Forums

jQuery UI Widgets Forums Grid Get selected row index

Tagged: , ,

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 9 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Get selected row index #72092

    drv232
    Participant

    I have a delete function which needs the selectedrowindex

    $("#deleterowbutton").on('click', function () {
                            var selectedrowindex = $("#jqxgrid").jqxGrid('getselectedrowindex');
                            var rowscount = $("#jqxgrid").jqxGrid('getdatainformation').rowscount;
                             console.log(selectedrowindex,"and rowscount:",rowscount);
                            if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
                                var id = $("#jqxgrid").jqxGrid('getrowid', selectedrowindex);
                                var commit = $("#jqxgrid").jqxGrid('deleterow', id);
                            }
                });
                

    But $("#jqxgrid").jqxGrid('getselectedrowindex'); returns -1 as a value. I have looked at all examples in the demo’s.

    Can you help me debug this?

    Get selected row index #72114

    Peter Stoev
    Keymaster

    Hi drv232,

    If it’s -1 then you don’t have selected row or you don’t use rows selection, but cells selection.

    Best Regards,
    Peter Stoev

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

You must be logged in to reply to this topic.