javascript - dataTable page length change issue -
I'm using dataTable 1.10, everything works well, but I found the following status The datatable does not support this behavior.
By default, I set the length of the page to 10, then I click on the next page, the items displayed in Table 11 to 20. Now I change the page length to 25, display the table item from 11 to 35. This is not my point. Whenever I change the length of the page, I want to display it from 1 item.
Is it possible to handle page length change events in datatable and customize that function?
Thanks for reading Hope you get help.
var tableHDR = '& lt; Table cellpadding = "0" cellspacing = "0" range = "0" square = "display" id = "alertlit" & gt; '+' & Lt; Thead & gt; & Lt; Tr & gt; + & Lt; Th & gt; Level & lt; / Th & gt; & Lt; Th & gt; Monitor name & lt; / Th & gt; & Lt; Th & gt; Alert message & lt; / Th & gt; & Lt; Th & gt; Raised top & lt; / Th & gt; & Lt; Th & gt; Action & lt; / Th & gt; '+' & Lt; / Tr & gt; & Lt; / Thead & gt; & Lt; / Table & gt; '; $ ('#view_content') Html (tableHDR); // global variable total = $ ('#lertlist'). True, "Aadata": AlertData, "BitWidth": False, "AAserting": [["3" "" Columns ":" AO Columns ": [[" Paging Type ":" Full-number "," BJUUUUUUUI " {"Sittle": "name", "" "" "" "" "" "" "", "mdata": "alert_level", "aswidth": "10%"}, {"sTitle": "name of monitor" "" "" "" False "bSearchable": "elevated", "amatata": "trigger admit time", "asunder": "20%"}, {"sTitle": "action" "," "Data": "monitor_name": "id", "bstable": false, "swoed": "20%"}, "column def": [{"target": 1, "data" "Render": function (data, type, complete, meta) {return escape HTML (statistics, type, complete, meta) {if (data == faucet} type data == '' data '' '' '' data '', '' Target '': 2, "data": "alert_mail", "render" undefined ') {return "";} var description = data.leng th & gt; 30? Data. Substr (0,30) ) '' ... ': return; escape HTML; description;}}, {"target": 4, "render": function (data, type, complete, meta) {return (" (& lt; span style = 'Cursor: Pointer' id = 'dismiss_alert_ "+ full.id +"' Class = 'dismiss' & gt; Dismiss & lt; / Span & gt; "+" & Lt; Span style = 'cursor: pointer' id = 'delete_alert_ "+ full.id +"' class = 'delete' & gt; Remove & lt; / Span & gt; | "+" & Lt; Span style = 'cursor: pointer' id = 'details_alert_' + full.id + "'class =' details' & gt; description ;); }}]});
Try it out, I found it from a data forum.
var t = $ ('# table-id'). Datable (); $ ('# Length li'). Click (function () {redrawWithNewCount (T, this.id);}); Function redrawWithNewCount (t, row_count) {// DataTables source greater or less right from var oSettings = t.fnSettings (); OSettings._iDisplayLength = parseInt (line path, 10); T._fnCalculateEnd (oSettings); / * If we have space to show additional lines (backup from end point - then do this * / if (oSettings.fnDisplayEnd () == oSettings.fnRecordsDisplay ()) {oSettings._iDisplayStart = oSettings.fnDisplayEnd () - oSettings ._iDisplayLength; if (oSettings._iDisplayStart & lt; 0) {oSettings._iDisplayStart = 0;}} If (oSettings._iDisplayLength == -1) {oSettings._iDisplayStart = 0;} t.fnDraw (oSettings); Return T; }
Comments
Post a Comment