JqGrid tableToGrid - display a message if rows are not found in the table

I am trying to create a grid using jqgrid in an html table. I can do this, but want to display a message if no rows are found in the table. How can i do this?

Here is my jquery code ...

jQuery.extend(jQuery.jgrid.defaults, {
                caption: "my list",
                autowidth: true,
                height: "100%",
                hidegrid: false,
                loadComplete: function() {
                    alert("Grid has been loaded");
                },
                colModel:[
                   { name: 'date', index: 'date', width: 0, resizable: false },
                   { name: 'icon', index: 'icon', width: 0, resizable: false },
                   { name: 'shop', index: 'shop', width: 0, resizable: false },
                   { name: 'delete', index: 'delete', width: 0, resizable: false }
                ]
            });
            tableToGrid("#item_table", {
               colNames: ['Date', '', 'Shop', 'Delete']
            });
+3
source share
2 answers

The standard message defined in $.jgrid.defaults.emptyrecords(see grid.locale-en.js) will be displayed by default only if the jqGrid is populated with deleted data downloaded from the server (see this answer ). The corresponding text (see grid.locale-en.js) "There are no entries to view" will be displayed on the right side of the status bar.

, "" jqGrid ( ) (. ). , jqGrid tableToGrid. beforeRequest, , jQuery.jgrid.defaults, tableToGrid. , loadComplete, / div "no rows" " jqGrid.

+6

. jqGrid.css, , "white-space: pre"

.ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space:pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}

( /* body */section), .

0

Source: https://habr.com/ru/post/1779548/


All Articles