EasyUI Forum
September 13, 2025, 08:52:05 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: set class selected to multiselect  (Read 10125 times)
pedroc
Newbie
*
Posts: 17


View Profile
« on: March 18, 2015, 02:17:08 PM »

I'm using a multiline select from an edit form, put the items that once were inserted in the same way I reload to display the items, now I need to put the class selected these items. how to do?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: March 18, 2015, 03:23:34 PM »

What editor are you using ? How do you reload your form data ? Please describe your question in more detail.
Logged
pedroc
Newbie
*
Posts: 17


View Profile
« Reply #2 on: March 19, 2015, 05:03:10 AM »

I am using a form where I have the multiselect the problem is, how to load it already inserted at a given time?

<input id="gd05" class="easyui-combobox" required style="width:68%" data-options="
                valueField:'id_area',
                textField:'area',
                onSelect: function(rec){
                    //$('#box1').combobox('clear');
                    var url = '<?= base_url() ?>index.php/c_grpodistrib/get_trab/'+rec.area;
                    $('#box1').combobox('reload', url);
                }">
        <select id="box1" name="trabajadores[]" class="easyui-combobox" editable='false' required style="width: 100%; height: 50px" data-options="
            textField:'nombre',
            valueField:'id',
            multiple:true,
            multiline:true">
        </select>

this is what I want to do in the Edit button onClick
$.ajax({
            type: "POST",
            cache: false,
            url: 'c_grpodistrib/get_trab_del_grpo/'+row.id_grpodistrib,
            dataType: 'json',
            success: function(dato) {
                var result = [];
                $.each(dato, function(idx, obj) {
                    result[idx]=obj.nombre;
                });
                $('#box1').combobox('setValues', result);
                $('#box1').combobox('reload', 'c_grpodistrib/get_trab_del_grpo/'+row.id_grpodistrib);
            },
            error : function(xhr, status) {
                alert('Esto nunca debe suceder');
            }
        });
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #3 on: March 19, 2015, 07:35:27 AM »

You can call 'setValues' method to select the special items, or set the 'selected' property to true for those items you want to select. The following item will be selected since it has the 'selected' property set to true.
Code:
[{
"id":3,
"text":"Ruby",
"selected":true
}]
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!