I'm using the combogrid with multiple property in a form.
I have 2 actions: Add and Edit, so when I do the Add, the combogrid it looks ok but in the php side only got the last item I selected.
To correct this issue I added like a "new" parameter in the onSubmit function for the submit method.
Like this:
param.almacenes = $('#almacenes').combogrid('getValues');
and it works, I've got every item I selected.
But when I want do a edit a register, I select it and I get a message error:
The object does not accept the property or method join.
In this case the combogird should load the values store in the data base in that field and I get a blank combogrid.
Here's my full code:
the html:
the combogrid:
<input id="almacenes" name="almacenes" class="easyui-combogrid" style="width:240px"
data-options="
multiple: true,
panelWidth:240,
panelHeight:280,
mode:'remote',
url: 'folder/get_almacenes.php',
idField:'id', //like 100, 300 o A23
textField:'id',
fitColumns:false,
columns:[[
{field:'ck',checkbox:true},
{field:'id',title:'Clave',width:50},
{field:'name',title:'Nombre',width:155}
]]"
/>
easyui function to save the form data:
function save(){
$('#form').form('submit',{
url: url,
onSubmit: function(param){
param.almacenes = $('#almacenes').combogrid('getValues'); //this instruction had to add to get all the items I select......otherwise I only get the last one select
var isValid = $(this).form('validate');
return isValid;
},
success: function(result){
var result = eval('('+result+')');
if (result.success){
$('#dlg').dialog('close');
$('#dg').datagrid('reload');
$.messager.alert('Aviso','Operación éxitosa','info');
} else{
$.messager.alert('Error',result.msg,'error');
}
}
});
}
and the php code:
//get the variable,
$almacenes = $_POST['almacenes'];
//the content should be like: 100,300,A23 (for example)
//and after do the insert to db
the field that stores this variable is varchar (100)
I'm using the 1.3.2. version
thank you so much
*sorry for my bad english