EasyUI Forum
September 14, 2025, 03:49:45 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Datagrid Scrollview no rows after scrolling down and reload in window  (Read 9866 times)
Wojak
Jr. Member
**
Posts: 63


View Profile WWW Email
« on: July 01, 2024, 01:01:20 PM »

Hi,

I have this error that while I scroll for example, to 200 row and then use this command
Code:
$('#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
Code:
$('#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
Logged
Wojak
Jr. Member
**
Posts: 63


View Profile WWW Email
« Reply #1 on: July 01, 2024, 01:11:27 PM »

Quote
I found that if I replace the command to open the window to be after reload then everything is ok

Never mind. It worked for a while. For no reason it stopped working again
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #2 on: July 03, 2024, 07:05:56 PM »

Please refer to this example https://www.jeasyui.com/demo/test/test20.html. It works fine.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!