jQWidgets Forums
jQuery UI Widgets › Forums › Lists › ComboBox › selectItem in a multiSelect bug
This topic contains 3 replies, has 2 voices, and was last updated by Peter Stoev 11 years, 5 months ago.
-
Author
-
This issue appears to be related to sorting order of items in the source data. The following is a modified code from your own jsfiddle (http://jsfiddle.net/jqwidgets/ZayKP/):
<div id=’jqxComboBox’></div>
<div>
<input style=”margin-top: 20px;” type=”button” id=’jqxButton’ value=”Select All Items” />
</div>
var source = [
“A”,
“B”,
“C”
];// Create a jqxComboBox
$(“#jqxComboBox”).jqxComboBox({
source: source,
multiSelect:true,
theme: ‘energyblue’,
width: ‘200px’,
height: ’25px’,
selectedIndex: 2
});
$(“#jqxButton”).jqxButton({
theme:’energyblue’
});
$(‘#jqxButton’).on(‘click’, function () {
$(“#jqxComboBox”).jqxComboBox(‘selectItem’,’B’);
$(“#jqxComboBox”).jqxComboBox(‘selectItem’,’C’);
$(“#jqxComboBox”).jqxComboBox(‘selectItem’,’A’);});
Running this will result in items ‘B’ and ‘C’ only being selected.
However, when you change the order the ‘selectItem’ calls to align them with the order of items as they appear in the source, everything works as expected, i.e.
$(‘#jqxButton’).on(‘click’, function () {
$(“#jqxComboBox”).jqxComboBox(‘selectItem’,’A’);
$(“#jqxComboBox”).jqxComboBox(‘selectItem’,’B’);
$(“#jqxComboBox”).jqxComboBox(‘selectItem’,’C’);});
will work fine, all three items get selected.Hi alexl,
The problem here is that you have an initially selected item so one of your selectItem calls will make a Toggle of the Selection.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Peter,
thanks for noticing the ‘selectedIndex’ property in the initialization call, it’s a leftoever from your jsfiddle code.However, I had just tried to remove it. The bug is still there.
BTW I never noticed anywhere in your API docs that any of ‘select’ type calls have a toggle effect. Is it the case for all widgets?Hi alexl,
When Multiple Selection is enabled, the behavior is that when you click with a Mouse over a Selected Item, it becomes unselected. Example: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxlistbox/multipleselection.htm?arctic. However, your scenario is different and there is really an issue which will be resolved with the next update of jQWidgets.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.