jQWidgets Forums

jQuery UI Widgets Forums Grid Row select/unselect

Tagged: ,

This topic contains 4 replies, has 2 voices, and was last updated by  dpibt 11 years, 6 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Row select/unselect #46269

    dpibt
    Participant

    Hello,

    I found when I was playing with row selection that if you have mode selection set to ‘multiplerows’ and programmatically unselect a row, then the $('#jqxgrid').jqxGrid('getselectedrowindex'); method returns -1 while before unselecting it returned the last selected row.

    To reporduce it I just render a jqxgrid with some registers and multiplerows selection mode on.
    -Select more than one row.
    -Get selected row index with $('#jqxgrid').jqxGrid('getselectedrowindex'); Returns last selected row.
    -Open firebug or any javascript interpeter and unselect a row with $('#'+this.id).jqxGrid('unselectrow',rowIndex);
    -Get selected row index with $('#jqxgrid').jqxGrid('getselectedrowindex'); Returns -1.

    Is that an intentioned behavior?

    Thank you!

    Row select/unselect #46271

    Peter Stoev
    Keymaster

    Hi dpibt,

    ‘getselectedrowindex’ in general should be used with single-row selection. ‘getselectedrowindexes’ is the method which you should use in multiple-selection modes.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Row select/unselect #46272

    dpibt
    Participant

    I understand. In fact it’s what I’m doing in my code but in the API documentation says:

    getselectedrowindex Method
    The expected selection mode is ‘singlerow’, ‘multiplerows’ or ‘multiplerowsextended’
    Gets the bound index of the selected row. Returns -1, if there’s no selection.

    So I guess my confusion comes from here.

    Thank you for your time.

    Row select/unselect #46273

    Peter Stoev
    Keymaster

    Hi dpibt,

    Well, it will return the selected row in multiple row selection mode, too and it does it, but may be in multiple rows selection mode, you would be interested in getting all Selected rows, right?

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Row select/unselect #46274

    dpibt
    Participant

    That’s right, the only thing I’m saying is that API documentation is out of date and as I wrote in my first post, when you programmatically unselect a row in multiple row selection mode and select a row with getselectedrowindex method, you don’t get a correct value. Instead you get a -1. Try it.

    Anyway, I won’t use this method with multiple row selection mode.

    Regards.

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

You must be logged in to reply to this topic.