Hi Thank you for the answer, but this is my first datagrid and I will need a little further help, because my structure is a little different from your.
Follow my code D00PRO is product and D00ART the color :
var articoli;
function trunkFormatter(value){
for(var i=0; i<articoli.length; i++){
if (articoli[i].MACAR0 == value) return articoli[i].MACAR0;
}
return value;
}
$(function() {
$.getJSON('list_art.php?tipoord='+ $("#tipoordine").val(), function(json) {
articoli = json;
$('#dg').edatagrid({
url: 'get_righe.php?file=' + $("#nomefile").val(),
updateUrl: 'update_righe.php?file='+ $("#nomefile").val(),
onAfterEdit: function (data) {
$('#dg').edatagrid('reload');
},
rowStyler:function(index,row){
if (row.PREDIV>0 && row.D00PRO != 0){
return 'background-color:pink;color:blue;font-weight:bold;';
}
if (row.D00PRO==0){
return 'background-color:yellow;color:blue;font-weight:bold;';
}
}
});
});
});
</script>
<h2>Gestione Dati</h2>
<div class="demo-info" style="margin-bottom:10px">
<div class="demo-tip icon-tip"> </div>
<div>Doppio click per modificare</div>
</div>
<table id="dg" title="Righe importate" style="width:1000px;height:500px"
toolbar="#toolbar" pagination="true" idField="E42POS"
rownumbers="true" fitColumns="true" singleSelect="true">
<thead>
<tr>
<!-- <th field="id_trunk" width="140" formatter="trunkFormatter" editor="{type:'combobox',options:{valueField:'id_trunk',textField:'nome',data:collegamenti,required:true}}">Righe</th> -->
<th field="D00POS" width="0" editor="text" hidden="true">id</th>
<th field="D00PRO" width="10" editor="text">Progressivo</th>
<th field="D00ART" width="50" formatter="trunkFormatter" editor="{type:'combobox',options:{valueField:'MACAR0',textField:'MADES0',data:articoli,required:true}}">Articolo</th>
</tr>
</thead>
</table>
<div id="toolbar">
<a href="#" class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="javascript:$('#dg').edatagrid('saveRow')">Salvare</a>
<a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="javascript:$('#dg').edatagrid('cancelRow')">Cancel</a>
</div>