jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox Default display data

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 12 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Default display data #16591

    Good day

    I want to make my combobox display (default) the very last retrieve data

    thanks in advance

    Default display data #16594

    Peter Stoev
    Keymaster

    Hi Jack The Dreamer,

    The “selectedIndex” property specifies the index of the displayed item. If you want to change the ComboBox’s default selection, you need to set this property during the widget’s initialization.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Default display data #16615

    Thanks Peter

    What I’m trying to do is when I update my database like updating birth place it will display in combobox by default after refreshing combobox

    selectedIndex: 0 <= it will select the very first item

    selectedIndex: (I want to assign the very last or highest index that was updated to my birthplace)

    Thanks again

    Default display data #16635

    Peter Stoev
    Keymaster

    Hi Jack The Dreamer,

    If you want to learn which is the highest index, you can do the following:

    1. Use the jqxDataAdapter’s loadComplete callback. That is a callback which is called when the dataAdapter is loaded with data.
    2. jqxDataAdapter has a field called “records” which contains the loaded data. As “records” is an Array, you can use the “length” property to get the number of loaded records.
    3. In the loadComplete callback, you can do this:

    $("#combobox").jqxComboBox({selectedIndex: dataAdapter.records.length-1});

    Hope this helps.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.