jQuery UI Widgets Forums Lists DropDownList Setcontent of dropdownlist

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Setcontent of dropdownlist #88436

    VitaliyST
    Participant

    Hi,
    I have 3 dropdownlists, checkboxes – true. I want to change the default content “Please choose”.
    1) I tried :
    ” $(“#ddlMyDropDownList”).jqxDropDownList(‘setContent’, ‘Please select Medications:’);” , BUT as soon as i open a DDL it will show again “Please choose”. 2) Then i tried : $(‘#jqxDropDownList’).on(‘open’, function (event) {
    $(“#ddlMyDropDownList”).jqxDropDownList(‘setContent’, ‘Please select Medications:’);
    });
    That’s not what i want,because it will show first “Please choose” ,for 2 seconds,and then my content “Please select Medications”);
    3) Also i tried “selectionRenderer: function () {return “Please select Medications:”} ” , that’s not what i need,because it won’t change the content at all on check/uncheck.
    Is it a way to change this content?

    • This topic was modified 7 years, 7 months ago by  VitaliyST.
    Setcontent of dropdownlist #88459

    Christopher
    Participant

    Hi VitaliyST,

    You can change the “Please choose” label through the placeHolder property of the jqxDropDownList. Here is a demo:
    http://jsfiddle.net/7UBGc/118/

    Best Regards,
    Christopher

    jQWidgets Team
    http://www.jqwidgets.com

    Setcontent of dropdownlist #88477

    VitaliyST
    Participant

    Hi Christopher,

    Thanks a lot, that’s what I needed (i just found it in the API, I don’t know how I didn’t see it…I am sorry for wasting your time on it).
    I have one more question.I have a jqXgrid in jqxDropDownButton (dropdowngrid), selectionmode – checkbox. How could I set a text on jqxDropDownButton when I click on the checkbox “check all/uncheck all”. I tried to set the text on rowselect/rowunselect event, and it works on “check all” , but when I click “uncheck all” the text on the jqxDropDownButton will be empty. Any ideas?

    Setcontent of dropdownlist #88638

    VitaliyST
    Participant

    hello?

    Setcontent of dropdownlist #88644

    Christopher
    Participant

    Hi VitaliyST,

    The setContent function of the jqxDropDownButton is used to set the content(the text) of the DropDown button. For example:

    var dropDownContent = '<div style="position: relative; margin-left: 3px; margin-top: 5px;">' + row['firstname'] + ' ' + row['lastname'] + '</div>';
    $("#jqxdropdownbutton").jqxDropDownButton('setContent', dropDownContent);

    This will set the data that is returned from a checkbox selection as the content of the DropdownButton.

    If you want the text to be empty when you click on “uncheck all” you can use the same setContent function but set a different content by checking if something from the jqxGrid is selected. For example:

    var nonSelected = '<div style="position: relative; margin-left: 3px; margin-top: 5px;">' + 'No Selection' + '</div>'; $("#jqxdropdownbutton").jqxDropDownButton('setContent', nonSelected);

    The code provided in the above lines is take from the jqxDropDownGrid demo, here:
    http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/dropdowngrid.htm?light

    Best Regards,
    Christopher

    jQWidgets Team
    http://www.jqwidgets.com

    • This reply was modified 7 years, 6 months ago by  Christopher.
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.