jQuery UI Widgets Forums Lists DropDownList specified values?

This topic contains 2 replies, has 3 voices, and was last updated by  bitman0101 11 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • specified values? #3121


    I very much like the way the dropdown looks and can be formatted, and I’d like to use your tools for a complete page. I don’t see how to tie the dropdown list to data selections though.

    Ordinarily, I would create the drop down in html (via php) like this:

    <option value="0" selected>Please Select One</option>
    <option value="10" >A Option</option>
    <option value="231" >B Option</option>
    <option value="42" >C Option</option>
    <option value="3" >D Option</option>

    Where the values reflect record IDs in a database. Can I do that here? It would be great to be able to feed the widget an array of value/display pairs, and then select the default option.

    • This topic was modified 12 years, 3 months ago by  robbrandt.
    • This topic was modified 12 years, 3 months ago by  robbrandt. Reason: code doesn't retain tags
    specified values? #3124

    Peter Stoev

    Hi Rob,

    You can feed the DropDown with value/display pairs very easily. I suggest you to take a look at this article which shows how to bind the jqxDropDownList to MySQL Database using PHP. The jqxDropDownList displays the data from the CompanyName column, but each item is also associated to the ContactName column. This is achieved by using the jqxDropDownList’s displayMember and valueMember properties.

    Best Regards,
    Peter Stoev

    jQWidgets Team

    specified values? #6865


    I originally came here with the same question. I was able to populate my entries with labels and values using the link Peter Stoev posted above.

    As I am already doing standard jquery AJAX calls, I prefer to not have to include unnecessary libraries and would prefer to build the data structures myself.

    For anyone interested, this is how to build the format without an AJAX call via dataAdapter:

              $(document).ready(function () {
    // prepare the data
    myRows = [{RecordName: "test1", RecordID: 100}, {RecordName: "test2", RecordID: 200}];
    source: myRows,
    theme: 'classic',
    width: 200,
    height: 25,
    selectedIndex: 0,
    displayMember: 'RecordName',
    valueMember: 'RecordID'
    var item = $("#dropdownlist").jqxDropDownList('getItem', 1 );
    var itemLabel = item["label"];
    var itemValue = item["value"];
    • This reply was modified 11 years, 10 months ago by  bitman0101.
    • This reply was modified 10 years, 7 months ago by  bitman0101.
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.