jQuery UI Widgets Forums Lists ListBox Get Selected items on filtered listbox

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Get Selected items on filtered listbox #122542

    Garfield
    Participant

    Hello

    With a filtered listbox, the getSelecteditems take the item by the display index and not with the real index => you don’t get the right selection.

    jsfiddle
    if you apply filter for “andrew” and clic on the select button => in the console, the selected item is “nancy” with the index 0.
    Andrew is in the index 1, with the filter the index is 0. if you select the item, jqwdigets get the index 0 “nancy” and not the filtered index 1 for “andrew”

    how can i get the right item after a filter ?
    Thanks

    Get Selected items on filtered listbox #122550

    Hi,

    You can get the index with the getSelectedIndex, then get all items with getItems and filter them by their visibility.
    When you have an array with the visible items you can use the index to access the selected items.
    See the btnselect click handler here in your example that I have modified: http://jsfiddle.net/75p4zxv1/

    If you have any additional questions, let us know!

    Best regards,
    Svetoslav Borislavov

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

    Get Selected items on filtered listbox #122555

    Garfield
    Participant

    perfect !

    thanks

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

You must be logged in to reply to this topic.