why doesn't this jEasyUI combobox get updated?

6.2k Views Asked by At

I am able to load my first combobox with field name "projectID".

When I select a combobox value, I want to populate the axcode field. I know that my url works, and the data that is retrieved is:

[{"id":"26","groupID":"1","projectID":"18","Description":"Holiday","isActive":"1"},{"id":"28","groupID":"1","projectID":"18","Description":"Other","isActive":"1"},{"id":"24","groupID":"1","projectID":"18","Description":"Sick Leave","isActive":"1"},{"id":"27","groupID":"1","projectID":"18","Description":"Unpaid Leave","isActive":"1"},{"id":"25","groupID":"1","projectID":"18","Description":"Vacation","isActive":"1"}]

Can someone tell me why this code doesn't work?

{field:'projectID',
title:'Project/Paid Leave',
width:100,
editor:{
    type:'combobox',
    options:{
        valueField:'id',
        textField:'DescriptionCode',
        data:cmbprojects,
        required:true,
        editable:false,
       onSelect:function(record){
            $('#axCode').combobox('reload','remote_combo_data.php?type=projectax&projectID='+record.id);
        }
// closes onSelect
    }
    // closes options
}
// closes editor
}
// closes field
,
{
field:'axCode',
title:'axCode',
width:100,
editor:{
    type:'combobox',
    valueField:'id',
    textField:'Description',
    data:cmbaxcodes,
    required:true,
    editable:false
    }
    // closes editor
,formatter:function(value,row,index){return row.Description;}
// closes formatter

}
// closes field
,
{
field:'activityID',
title:'Activity',
width:100,
    editor:{
        type:'combobox',
        options:{
            // this is a key/value pair from the data source
            valueField:'id',
            textField:'ActivityCode',
            data:cmbactivities,
            required:true,
            editable:false
        }
        // closes options
    }
    // closes editor
,formatter:function(value,row,index){return row.ActivityCode;}
}
//closes field
1

There are 1 best solutions below

0
On

you can try to do like this

    <select class="easyui-combobox " data-options="
        required:true,
        valueField:'family_id',
        textField:'family',
        url:'<?php echo site_url(); ?>/ref_json/DataFamily',
        onSelect: function(rec){ 
            var url = '<?php echo site_url(); ?>/ref_json/DataMaterial1/'+rec.family_id; 
            $('#material').combobox('reload',url);
        }" id="family" name="family" style="width:120px;">
    </select>