jQuery UI Widgets › Forums › Lists › DropDownList › Setcontent of dropdownlist
Tagged: angular dropdownlist, bootstrap dropdownlist, javascript dropdownlist, jQuery DropDownList, jqwidgets dropdownlist, jqxdropDownList placeHolder
This topic contains 4 replies, has 2 voices, and was last updated by Christopher 7 years, 11 months ago.
-
Author
-
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?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,
ChristopherjQWidgets Team
http://www.jqwidgets.comHi 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?hello?
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?lightBest Regards,
ChristopherjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.