|
Title: Cannot set single value for multiple combobox Post by: bakoma on July 05, 2014, 09:56:42 PM I have a multiple combobox like the following.
<input class="easyui-combobox" id="cc" name="cc" data-options=" data:[{ID:1,Name:'A'},{ID:2,Name:'B'},{ID:3,Name:'C'},{ID:4,Name:'D'},{ID:5,Name:'E'},{ID:6,Name:'F'}], method: 'get', valueField: 'ID', textField: 'Name', multiple:true, panelWidth: 350, panelHeight: 'auto' " style="width: 550px;" > If I pick options 1 and 3, I am selecting A and C. The value saved in database is 1,3. When I load 1,3 back into the form for this field, I get A,,,C displayed in the combobox. This looks a little bit odd but OK. However if I pick a single value, say, C in this case. Database saves 3 in the table. The odd thing is that when I load this value 3 back to the form for this field, I would expect it to show C. Unfortunately, it shows nothing. I use the following to load database value back: $('#myForm').form('load', 'mywebservice.php'); Please help. Title: Re: Cannot set single value for multiple combobox Post by: stworthy on July 06, 2014, 02:03:12 AM Please use firebug to see what data returned from 'mywebservice.php' and correct it if possible. The data must be an array, each item should be the item value. Try the code below, it works fine.
Code: $('#myForm').form('load', {cc:[1,3]}); |