Hi ,
I have a problem with edatagrid.
I need an editable datagrid with comboboxes columns.
I have used for this, the edatagrid.
I could successfully insert, update an delete records. I could select the records too, but, the combobox fields (on the grid) doesnt show the text values (it shows nothing) during the grid load. It only shows the text values when selecting or editing the row.
I dont know what am I doing wrong, can you help me pleaseee?
This is mi grid declaration in javascript
$(function(){
$('#dg').edatagrid({
url: 'get.php',
saveUrl: 'save.php',
updateUrl: 'update.php',
destroyUrl: 'destroy.php'
});
});
this is the html part
<table id="dg" title="Edicion de Limites" style="width:900px;height:550px"
toolbar="#toolbar" pagination="true" idField="id"
rownumbers="false" fitColumns="true" singleSelect="true">
<thead>
<tr>
<th field="id" width="50">id</th>
<th data-options="field:'producto_id',width:100,
formatter:function(value,row){
return row.nombre;
},
editor:{
type:'combobox',
options:{
valueField:'id',
textField:'nombre',
url:'get_combo_data.php?tabla=productos',
required:true
}
}">Producto</th>
<th field="orden" width="50" editor="{type:'validatebox',options:{required:true}}">orden</th>
<th field="comentario" width="50" editor="{type:'validatebox',options:{required:true}}">comentario</th>
<th field="valor" width="50" editor="{type:'validatebox',options:{validType:'number',required:true}}">valor</th>
</tr>
</thead>
</table>
The combo url returns data like this
[{"id":"2","nombre":"Bovinos","abreviatura":"BOB"},{"id":"3","nombre":"Animal de Caza","abreviatura":""}]
and the grid php returns
[{"id":"72","producto_id":"2"},{"id":"73","producto_id":"41"}]
The combobox part of the grid must show the field nombre, but it doesnt.
I 'll appreciate any help on it!!!
Thanks!
Marcelo
EasyUI