EasyUI Forum
November 14, 2024, 02:04:08 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1] 2 3 ... 5
1  General Category / EasyUI for jQuery / Re: Datagrid custom resetSort changes emptyMsg on: November 11, 2024, 11:55:44 AM
After refreshing the data is there, but 'emptyMsg' sometimes does not disappear. After it stays on the screen, I checked what 'emptyMsg' is in the settings and from text such as '123' it changes to ''. And after it stays on the screen and changes to '', it doesn't disappear after trying to refresh all the time
2  General Category / EasyUI for jQuery / Datagrid custom resetSort changes emptyMsg on: November 09, 2024, 05:07:05 PM
I found a bug using a method from 2015 to reset sorting.
If my emptyMsg is set to anything but "" then it returns it to "".

Code:
$.extend($.fn.datagrid.methods, {
    resetSort: function (jq, param) {
        return jq.each(function () {
            var state = $.data(this, 'datagrid');
            var opts = state.options;
            var dc = state.dc;
            var header = dc.header1.add(dc.header2);
            header.find('div.datagrid-cell').removeClass('datagrid-sort-asc datagrid-sort-desc');
            param = param || {};
            opts.sortName = param.sortName;
            opts.sortOrder = param.sortOrder || 'asc';
            if (opts.sortName) {
                var names = opts.sortName.split(',');
                var orders = opts.sortOrder.split(',');
                for (var i = 0; i < names.length; i++) {
                    var col = $(this).datagrid('getColumnOption', names[i]);
                    header.find('div.' + col.cellClass).addClass('datagrid-sort-' + orders[i]);
                }
            }
            $(this).datagrid('reload');
        })
    }
});

After using this method also the emptyMsg doesn't disappear for datagrid view.
3  General Category / EasyUI for jQuery / Re: [SOLVED] Datagrid editing row methonds to save and cancel with enter and escape on: October 25, 2024, 02:35:04 AM
Is there a simple method to save and cancel while being on the page/tab and not in a specific editor?

Also a question, can i add a way in the “onBeginEdit” function that when you click a cell, so that the cursor is already in that editor that is assigned to that cell?
4  General Category / EasyUI for jQuery / Re: Datagrid data column width broken on: October 11, 2024, 03:05:08 PM
I found a code that calls
Code:
_83b.ss.clean();
it removes the styles for width in datagrid "<style>" and never creates a new styles for columns it lefts only two classes
Code:
.datagrid-header-rownumber and .datagrid-cell-rownumber

After a reload by using
Code:
$('#dg').datagrid('clearSelections').datagrid('removeFilterRule').datagrid('reload');
it loses the styles

Code:
_83b.ss.clean();

If i comment it out it works fine, i wonder why Huh

Im using version 1.10.19
5  General Category / EasyUI for jQuery / Problem with scrollview rendering rows on: October 08, 2024, 06:24:19 AM
Hello,
I have again noticed a problem with the Scrollview in Datagrid. I have two datagrids with scrollview on the site. During the first load up, the rows do not render and after getData it shows any data, but not the “rows” are empty. Checking the item, I see that cells are generated, but they are empty. The POST method to the server renders the variable “rows”. After reload it shows correctly.

Code:
$(function () {
    $('#hor-premia-projektowa').datagrid({
        url: 'p/.../select-premia-projektowa.php',
        columns: [[
            { field: 'data_wprowadzenia', title: 'Data wprowadzenia', width: '120px', sortable: true, halign: 'center' },
            { field: 'wprowadzajacy', title: 'Wprowadzający', width: '100px', sortable: true, halign: 'center' },
            { field: 'realizacja_numer', title: 'Realizacja', width: '80px', sortable: true, align: 'center' },
            { field: 'nazwisko', title: 'Nazwisko', width: '100px', sortable: true, halign: 'center' },
            { field: 'imie', title: 'Imie', width: '100px', sortable: true, halign: 'center' },
            { field: 'kwota', title: 'Kwota', width: '90px', sortable: true, halign: 'center', align: 'right',
                formatter: function (value, row, index) {
                    if (value > 0) {
                        return new Intl.NumberFormat('pl-PL', { useGrouping: true, style: 'currency', currency: 'PLN' }).format(value);
                    } else {
                        return '';
                    }
                }
            },
            { field: 'opis', title: 'Opis', width: '430px', sortable: true, halign: 'center' },
            { field: 'zatwierdzona', title: 'Zatwierdzona', width: '80px', sortable: true, align: 'center',
                formatter: function (value, row, index) {
                    switch (value) {
                        case '1':
                            return '<i style="color:green;" class="fa fa-check fa-xl"></i>';
                        case '2':
                            return '<i style="color:red;" class="fa fa-times fa-xl"></i>';
                        default:
                            return '';
                    }
                }
            },
            { field: 'data_zatwierdzenia', title: 'Data zatwierdzenia', width: '120px', sortable: true, halign: 'center' },
            { field: 'zatwierdzajacy', title: 'Zatwierdzający', width: '100px', sortable: true, halign: 'center' },
            { field: 'data_wyplaty', title: 'Data naliczenia', width: '100px', sortable: true, align: 'center' },
            { field: 'wyplacona', title: 'Wypłacona', width: '80px', sortable: true, align: 'center',
                formatter: function (value, row, index) {
                    switch (value) {
                        case '1':
                            return '<i style="color:inherit;" class="fa fa-coins fa-xl"></i>';
                        default:
                            return '';
                    }
                }
            },
            { field: 'wyplacajacy', title: 'Wypłacający', width: '100px', sortable: true, halign: 'center' },
        ]],
        idField: 'id',
        singleSelect: true,
        rownumbers: true,
        // showFooter: true,
        pageSize: 100,
        remoteFilter: true,
        filterDelay: 1000,
        remoteSort: true,
        view: scrollview,
        onDblClickRow: function (index, row) {
            $(this).datagrid('selectRow', index);
            horPremiaProjektowaWinOpen(row.id);
        }
    }).datagrid('enableFilter');

    $('#hor-premia-projektowa-budzet').datagrid({
        url: 'p/.../select-premia-projektowa-budzet.php',
        columns: [[
            { field: 'realizacja_numer', title: 'Realizacja', width: '120px', sortable: true, halign: 'center' },
            { field: 'budzet', title: 'Budżet', width: '120px', sortable: true, halign: 'center', align: 'right',
                formatter: function (value, row, index) {
                    return new Intl.NumberFormat('pl-PL', { useGrouping: true, style: 'currency', currency: 'PLN' }).format(value);
                }
            },
            { field: 'wykorzystany_budzet', title: 'Wykorzystany budżet', width: '120px', sortable: true, halign: 'center', align: 'right',
                formatter: function (value, row, index) {
                    return new Intl.NumberFormat('pl-PL', { useGrouping: true, style: 'currency', currency: 'PLN' }).format(value);
                }
            },
            { field: 'roznica', title: 'Różnica', width: '120px', sortable: true, halign: 'center', align: 'right',
                formatter: function (value, row, index) {
                    return new Intl.NumberFormat('pl-PL', { useGrouping: true, style: 'currency', currency: 'PLN' }).format(value);
                }
            },
            { field: 'data_modyfikacji', title: 'Data modyfikacji', width: '160px', sortable: true, align: 'center' },
            { field: 'data_wprowadzenia', title: 'Data wprowadzenia', width: '160px', sortable: true, halign: 'center' },
        ]],
        idField: 'id_realizacja',
        singleSelect: true,
        rownumbers: true,
        pageSize: 100,
        remoteFilter: true,
        filterDelay: 1000,
        remoteSort: true,
        clientPaging: false,
        view: scrollview,
        onDblClickRow: function (index, row) {
            $(this).datagrid('selectRow', index);
            horPremiaProjektowaBudzetWinOpen(row.id_realizacja);
        }
    }).datagrid('enableFilter');
});
6  General Category / EasyUI for jQuery / Re: Datagrid data column width broken on: September 23, 2024, 05:10:14 AM
I found that on a working example, you add the CSS code file inline. And then the class is one of.
Code:
<div class="datagrid-cell hor-tcerp-zlozenia_datagrid-cell-c8-object_name"><span>Object Name</span><span class="datagrid-sort-icon"></span></div>

Code:
.datagrid-header-rownumber{width:29px}
.datagrid-cell-rownumber{width:29px}
.hor-tcerp-zlozenia_datagrid-cell-c8-kompletacja{width:34px}
.hor-tcerp-zlozenia_datagrid-cell-c8-item_id_revision{width:249px}
.hor-tcerp-zlozenia_datagrid-cell-c8-object_name{width:599px;}
.hor-tcerp-zlozenia_datagrid-cell-c8-object_type_pl{width:139px}
.hor-tcerp-zlozenia_datagrid-cell-c8-qty{width:39px}
.hor-tcerp-zlozenia_datagrid-cell-c8-qty_total{width:69px}
.hor-tcerp-zlozenia_datagrid-cell-c8-ilosc_pozycji{width:69px}
.hor-tcerp-zlozenia_datagrid-cell-c8-ilosc_pozycji_kompletnych{width:69px}
.hor-tcerp-zlozenia_datagrid-cell-c8-procent_kompletacji{width:69px}
.hor-tcerp-zlozenia_datagrid-cell-c8-procent_kompletacji_wydanych{width:69px}
.hor-tcerp-zlozenia_datagrid-cell-c8-procent_zamontowanych{width:69px}
.hor-tcerp-zlozenia_datagrid-cell-c8-planowana_data_kompletacji{width:99px}
.hor-tcerp-zlozenia_datagrid-cell-c8-opcje{width:79px}

But in the datagrid that doesn't work, no such file is created and those class names from the columns are not there
Code:
<div class="datagrid-cell hor-tcerp-pozycje-kompletacja-dg_datagrid-cell-c10-object_name" style="text-align: center;"><span>Object name</span><span class="datagrid-sort-icon"></span></div>

I have an inline file with “c9”, but already another one that should be with “c10” is empty, there is only the following in it

Code:
.datagrid-header-rownumber{width:29px}
.datagrid-cell-rownumber{width:29px}
7  General Category / EasyUI for jQuery / Re: Datagrid editing row methonds to save and cancel with enter and escape on: September 11, 2024, 06:29:15 AM
Works like a charm Grin
8  General Category / EasyUI for jQuery / [SOLVED] Datagrid editing row methonds to save and cancel with enter and escape on: September 10, 2024, 01:02:48 PM
Hello,
I would like to add to the datagrid the ability to edit after two clicks, I am already able to do this. But also I would like to add that when I start to edit a row then after I click enter or escape it is to save the row or cancel the row. Is there such a possibility?
Also will this only work on one datagrid or many?
9  General Category / EasyUI for jQuery / Re: Datagrid Scrollview no rows after scrolling down and reload in window 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
10  General Category / EasyUI for jQuery / Datagrid Scrollview no rows after scrolling down and reload in window 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
11  General Category / EasyUI for jQuery / Re: Numberbox precision without behind zeros on: June 18, 2024, 10:06:39 AM
Ahh, now I understand. I forgot to add formatter also in row and not only in editor. Thanks for your quick help and sorry for my oversight
12  General Category / EasyUI for jQuery / Re: Numberbox precision without behind zeros on: June 13, 2024, 01:14:36 PM
Works great, for numberbox as input. But for editor it still shows as it was, but after entering edits it already shows correctly

This works as intended
Code:
$('#nb').numberbox({
decimalSeparator: ',',
precision: 3,
formatter: function (value) {
if (value) {
value = parseFloat(value);
}
value += '';
const dpos = value.indexOf('.');
if (dpos >= 0) {
const s1 = value.substring(0, dpos);
const s2 = value.substring(dpos + 1, value.length);
return s1 + ',' + s2;
} else {
return value;
}
}
});

It doesn't work properly
Code:
$('#dg').datagrid({
url: '...',
columns: [[
{
field: 'ilosc',
title: 'Ilość',
width: '50px',
halign: 'center',
align: 'right',
editor: {
type: 'numberbox',
options: {
precision: 3,
decimalSeparator: ',',
formatter: function (value) {
if (value){
value = parseFloat(value);
}
value += '';
const dpos = value.indexOf('.');
if (dpos >= 0){
const s1 = value.substring(0,dpos);
const s2 = value.substring(dpos+1,value.length);
return s1+','+s2;
} else {
return value;
}
}
}
}
},
]],
idField: 'id',
rownumbers: true,
singleSelect: true,
onSelect: function (index, row) {
$(this).datagrid('unselectRow', index);
},
onBeforeEdit: function (index, row) {
$(this).datagrid('refreshRow', index);
},
onEndEdit: function (index, row) {
if (parseFloat(row.ilosc) <= 0) {
row.ilosc = 1;
}
},
onAfterEdit: function (index, row) {
$(this).datagrid('refreshRow', index);
},
onCancelEdit: function (index, row) {
$(this).datagrid('refreshRow', index);
}
}).datagrid('enableCellEditing');
Attached are photos that show incorrect operation
13  General Category / EasyUI for jQuery / Re: Numberbox precision without behind zeros on: June 11, 2024, 01:42:29 PM
And also is it possible to add this feature to numberbox as editor in datagrid?
14  General Category / EasyUI for jQuery / [SOLVED] Numberbox precision without behind zeros on: June 11, 2024, 12:49:01 PM
Hello,
I would like to make the numberbox after entering the number "10" to show "10" and after entering the number "10,1" to show "10,1" and not "10,100". Is this possible?

I currently found this code, from 2014, however it leaves zeros after the number

Code:
$('#nb').numberbox({
min: 0,
max: parseFloat(row.ilosc) - parseFloat(row.iloscDostarczona || 0),
decimalSeparator: ',',
precision: 3,
formatter: function (value) {
var opts = $(this).numberbox('options');
var s = $.fn.numberbox.defaults.formatter.call(this, value);
var idx = s.indexOf(opts.decimalSeparator + '000');
if (idx >= 0) {
s = s.substr(0, idx);
}
return s;
}
});
15  General Category / EasyUI for jQuery / Re: Datagrid data column width broken on: April 18, 2024, 03:13:33 AM
I changed to the newest version, but still the same problem. Is there a way to fix it by calling method?
Pages: [1] 2 3 ... 5
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!