Code:
$('#dg').datagrid('clearSelections').datagrid('loadData', { total: 0, rows: [] });
$('#dg').datagrid('clearSelections').datagrid('loadData', { total: 0, rows: [] }).datagrid();
Code:
$('#dg').datagrid({
columns: [[
{ field: 'nazwa', title: 'Nazwa', width: '160px', halign: 'center' },
{ field: 'opis', title: 'Opis', width: '160px', halign: 'center' },
{ field: 'typ', title: 'Typ', width: '160px', halign: 'center',
styler: function (value, row, index) {
if (!row.idProdukt > 0) {
return 'background:#FFC300;';
}
}
},
{ field: 'nrKatalogowy', title: 'Nr katalogowy', width: '160px', halign: 'center' },
{ field: 'producent', title: 'Producent', width: '120px', halign: 'center',
styler: function (value, row, index) {
if (!row.idProducent > 0) {
return 'background:#FFC300;';
}
}
},
{ field: 'ilosc', title: 'Ilość', width: '50px', halign: 'center', align: 'right' },
{ field: 'jm', title: 'J.m.', width: '50px', halign: 'center',
styler: function (value, row, index) {
if (!row.idJm > 0) {
return 'background:#FFC300;';
}
}
},
{ field: 'cena', title: 'Cena', width: '80px', halign: 'center' },
{ field: 'rabat', title: 'Rabat', width: '50px', halign: 'center', align: 'right',
formatter: function (value, row, index) {
return (value || 0) + '%';
}
},
{ field: 'wartosc', title: 'Wartość', width: '80px', halign: 'center' },
{ field: 'waluta', title: 'Waluta', width: '60px', halign: 'center',
styler: function (value, row, index) {
if (!row.idWaluta > 0) {
return 'background:#FFC300;';
}
}
},
]],
idField: 'id',
rownumbers: true,
singleSelect: true,
});