datatable load state bugfix
This commit is contained in:
+4
-6
@@ -853,7 +853,7 @@ Request.JSONF = function(options){//oke
|
|||||||
strBody += '</tbody>';
|
strBody += '</tbody>';
|
||||||
|
|
||||||
$(divData).append(strTab + strHead + strBody + strFoot + '</table>');
|
$(divData).append(strTab + strHead + strBody + strFoot + '</table>');
|
||||||
var opsi = { responsive: true, columnDefs: [{responsivePriority:1,targets:0},{responsivePriority:2,targets:1}], lengthMenu: [], dom: '<"row"<"col-sm-12"tr>><"row"<"col-sm-12 col-lg-auto"<"toolbar">><"col-sm-3 col-lg-auto ms-lg-auto"l><"col-sm-9 col-lg-auto"p>>', autoWidth: false, processing: true, searching: false, columns: aSortCol, order: [[iCol, (ini.config.sort_dir=='A'?'asc':'desc')]], pageLength: ini.config.row_count, stateSave: true, stateSaveCallback: function(sett,data){localStorage.setItem(ini.id,JSON.stringify(data));}, stateLoadCallback: function(sett){try{var data=JSON.parse(localStorage.getItem(ini.id));data.length=ini.config.row_count;return data;}catch(e){}} };
|
var opsi = { responsive: true, columnDefs: [{responsivePriority:1,targets:0},{responsivePriority:2,targets:1}], lengthMenu: [], dom: '<"row"<"col-sm-12"tr>><"row"<"col-sm-12 col-lg-auto"<"toolbar">><"col-sm-3 col-lg-auto ms-lg-auto"l><"col-sm-9 col-lg-auto"p>>', autoWidth: false, processing: true, searching: false, columns: aSortCol, order: [[iCol, (ini.config.sort_dir=='A'?'asc':'desc')]], pageLength: ini.config.row_count, stateSave: true, stateSaveCallback: function(sett,data){localStorage.setItem(ini.id,JSON.stringify(data));}, stateLoadCallback: function(sett){try{var data=JSON.parse(localStorage.getItem(ini.id))??{};data.length=ini.config.row_count;return data;}catch(e){console.log(e)}} };
|
||||||
/*****/
|
/*****/
|
||||||
if (ini.config.live){
|
if (ini.config.live){
|
||||||
var post_data = {};
|
var post_data = {};
|
||||||
@@ -867,8 +867,6 @@ Request.JSONF = function(options){//oke
|
|||||||
opsi.ajax = {
|
opsi.ajax = {
|
||||||
url: vars.url,
|
url: vars.url,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
|
||||||
cache: false,
|
|
||||||
data: post_data,
|
data: post_data,
|
||||||
dataFilter: function(data){
|
dataFilter: function(data){
|
||||||
var json = jQuery.parseJSON(data), jsono = {};
|
var json = jQuery.parseJSON(data), jsono = {};
|
||||||
@@ -961,7 +959,7 @@ Request.JSONF = function(options){//oke
|
|||||||
});
|
});
|
||||||
menudiv.val(_select);
|
menudiv.val(_select);
|
||||||
// apply select function
|
// apply select function
|
||||||
if (ini.config.func_select) {
|
if (ini.config.func_select){
|
||||||
$('#'+ini.id+'Tabel tbody').on('click', 'tr', function(){
|
$('#'+ini.id+'Tabel tbody').on('click', 'tr', function(){
|
||||||
var dta = otabel.row(this).data();
|
var dta = otabel.row(this).data();
|
||||||
var fnc = ini.config.func_select.split('.');
|
var fnc = ini.config.func_select.split('.');
|
||||||
@@ -970,7 +968,7 @@ Request.JSONF = function(options){//oke
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// apply option of record / row
|
// apply option of record / row
|
||||||
if (ini.option.length > 0) {
|
if (ini.option.length > 0){
|
||||||
$('#'+ini.id+'Tabel thead input[type=checkbox][id*=_cbhead_]').off('change');
|
$('#'+ini.id+'Tabel thead input[type=checkbox][id*=_cbhead_]').off('change');
|
||||||
$('#'+ini.id+'Tabel tbody input[type=checkbox][id*=_cbox_]').off('change');
|
$('#'+ini.id+'Tabel tbody input[type=checkbox][id*=_cbox_]').off('change');
|
||||||
$('#'+ini.id+'Tabel tbody').off('click');
|
$('#'+ini.id+'Tabel tbody').off('click');
|
||||||
@@ -989,7 +987,7 @@ Request.JSONF = function(options){//oke
|
|||||||
this.checked = this.value == val.avalue[0];
|
this.checked = this.value == val.avalue[0];
|
||||||
});
|
});
|
||||||
} else if (val.type == 'button'){
|
} else if (val.type == 'button'){
|
||||||
if (val.icon == 'fon-tabel-dt') {
|
if (val.icon == 'fon-tabel-dt'){
|
||||||
$('#'+ini.id+'Tabel tbody').on('click', '.fon-tabel-dt', function(){
|
$('#'+ini.id+'Tabel tbody').on('click', '.fon-tabel-dt', function(){
|
||||||
var tr = $(this).closest('tr');
|
var tr = $(this).closest('tr');
|
||||||
var row = otabel.row(tr);
|
var row = otabel.row(tr);
|
||||||
|
|||||||
Reference in New Issue
Block a user