Hi,
I have this error that while I scroll for example, to 200 row and then use this command
$('#dg').datagrid('removeFilterRule').datagrid('clearSelections').datagrid('reload');
then no rows are displayed. I have to use the button that triggers the reload of this datagrid or scroll up or down.
The code for #dg
$('#dg').datagrid({
url: '...',
columns: [[
{ field: 'opcje', title: 'Opcje', width: '50px', align: 'center',
formatter: function (value, row, index) {
if (row.added) {
return '<a href="javascript:void(0)" onclick="a(' + row.id + ')" style="color:inherit;" title="Usuń"><i class="fa-solid fa-trash"></i></a>';
}
return '<a href="javascript:void(0)" onclick="b(' + row.id + ')" style="color:inherit;" title="Dodaj"><i class="fa-solid fa-plus"></i></a>';
}
},
{ field: 'producent', title: 'Producent', width: '180px', halign: 'center' },
{ field: 'nazwa', title: 'Nazwa', width: '260px', halign: 'center' },
{ field: 'typ', title: 'Typ', width: '210px', halign: 'center' },
{ field: 'nrKatalogowy', title: 'Nr katalogowy', width: '210px', halign: 'center' },
{ field: 'opis', title: 'Opis', width: '210px', halign: 'center' },
{ field: 'jmNazwa', title: 'J.m.', width: '50px', halign: 'center' },
]],
idField: 'id',
rownumbers: true,
singleSelect: true,
pageSize: 100,
remoteFilter: true,
filterDelay: 1000,
remoteSort: true,
clientPaging: false,
view: scrollview,
onLoadSuccess: function () {
c.forEach(el => {
$(this).datagrid('updateRow', { index: $(this).datagrid('getRowIndex', el), row: { added: 1 } });
});
},
rowStyler: function (index, row) {
if (row.added) {
return 'background-color:lightgreen;';
}
},
onSelect: function (index, row) {
$(this).datagrid('unselectRow', index);
},
onDblClickRow: function (index, row) {
if (row.added) {
a(row.id);
} else {
b(row.id);
}
},
}).datagrid('enableFilter', [{ field: 'opcje', type: 'label' }]);
I found that if I replace the command to open the window to be after reload then everything is ok