jQuery UI Widgets Forums Lists ListBox Refresh list

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Refresh list Posts
  • Refresh list #6151

    PaoloBax
    Participant

    Is it possible to refresh the list (so that items are rendered again, for example because one of them changed) without reassigning the source (which would cause the selected index to be lost)?

    Refresh list #6169

    Peter Stoev
    Keymaster

    Hi PaoloBax,

    – You can use the jqxListBox’s ‘refresh’ method and invoke it with parameter – true.
    – Another option is to reassign the ‘source’ object and call the jqxListBox’s selectIndex method to select an item.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Refresh list #6176

    PaoloBax
    Participant

    Thank you.
    I wasn’t aware of the refresh method (it is not listed in the API).
    About reassigning the source and re-selecting an item, this has a drawback: the select event is fired. In my case this causes a loop in the code.
    I think it would be useful to have separate events when the selection is caused by user interaction (click on the list) and when it is caused programmatically by setting the selectedIndex property.

    Refresh list #6178

    Peter Stoev
    Keymaster

    Hi PaoloBax,

    Actually, it is a correct behavior the ‘select’ event to be raised when an item is selected even with a method call. The ‘select’ event arguments can be used to determine the selection’s source – API, keyboard or mouse.

     $('#jqxListBox').bind('select', function (event) {
    var args = event.args;
    var selectionType = args.type;
    });

    The args.type values could be: ‘none’ – selection is via a function call, ‘keyboard’ – selection is via a keyboard navigation, ‘mouse’ – selection is via mouse click.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Refresh list #6179

    PaoloBax
    Participant

    Thank you, the arguments are perfect for my needs.

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

You must be logged in to reply to this topic.