jQWidgets Forums

jQuery UI Widgets Forums Lists ListBox SelectedItem behavior

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • SelectedItem behavior #8823

    SpaceQuester
    Member

    Hi, guys!

    How can I set preselected item on ListBox with dataAdapter?

    1st situation: only source

    var source_jqx_listbox_year = [
    "2012",
    "2013"
    ];
    $("#jqxListBoxYear").jqxListBox({ source: source_jqx_listbox_year, width: 700, height: 48, theme: '' });
    $("#jqxListBoxYear").jqxListBox('selectIndex', 0);

    Here the cursor is located on 1st item.

    2nd situation: dataAdapted instead of source

    var source_jqx_listbox_quarter =
    {
    datatype: "tab",
    datafields: [
    { name: 'quarter_name'},
    { name: 'quarter_digit'}
    ],
    url: '../../quarters.txt'
    };
    dataAdapter_jqx_listbox_quarter = new $.jqx.dataAdapter(source_jqx_listbox_quarter);
    $("#jqxListBoxQuarter").jqxListBox({ source: dataAdapter_jqx_listbox_quarter, displayMember: "quarter_name", valueMember: "quarter_digit", width: 700, height: 96, theme: '' });
    $("#jqxListBoxQuarter").jqxListBox('selectIndex', 2 );
    quarters.txt:
    QUARTER_1 1
    QUARTER_2 2
    QUARTER_3 3
    QUARTER_4 4

    Why here cursor is not set on 3rd item? And how can I preselect it?

    SelectedItem behavior #8826

    Peter Stoev
    Keymaster

    Hi SpaceQuester,

    The selectIndex method in the second situation is called before your data is loaded. You should call it in the jqxDataAdapter’s loadComplete callback.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    SelectedItem behavior #8836

    SpaceQuester
    Member

    Thank u. I understand the behavior.

    Please, another little question: How is the property called, that when I mouseovered above the cell, the cell is grayed out. But I need that nothing would be happened and cell color is always staing white and does not respond to mouse move.

    SelectedItem behavior #8841

    Peter Stoev
    Keymaster

    Hi SpaceQuester,

    The highlight behavior can be disabled by setting the ‘enableHover’ property to false.

    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.