EasyUI Forum
November 04, 2025, 04:23:53 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Cannot set single value for multiple combobox  (Read 8334 times)
bakoma
Newbie
*
Posts: 13


View Profile Email
« 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.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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]});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!