|
Lines 938-943
function _dt_add_delay(table_dt, table_node, delay_ms) {
Link Here
|
| 938 |
}); |
938 |
}); |
| 939 |
} |
939 |
} |
| 940 |
|
940 |
|
|
|
941 |
function _dt_get_saved_state( localstorage_config, columns_settings ){ |
| 942 |
var tables = JSON.parse( localstorage_config ); |
| 943 |
// if a table configuration was found in local storage, parse it |
| 944 |
if( tables ){ |
| 945 |
var stateSave_column_visibility = []; |
| 946 |
$(tables.columns).each(function(){ |
| 947 |
stateSave_column_visibility.push( this.visible === true ? 0 : 1 ); |
| 948 |
}); |
| 949 |
$.each( columns_settings, function( index, key ){ |
| 950 |
if( stateSave_column_visibility[ index ] !== columns_settings[key] ){ |
| 951 |
columns_settings[ index ].is_hidden = stateSave_column_visibility[ index ]; |
| 952 |
} |
| 953 |
}); |
| 954 |
return columns_settings; |
| 955 |
} else { |
| 956 |
return columns_settings; |
| 957 |
} |
| 958 |
} |
| 959 |
|
| 941 |
(function($) { |
960 |
(function($) { |
| 942 |
|
961 |
|
| 943 |
/** |
962 |
/** |
|
Lines 992-997
function _dt_add_delay(table_dt, table_node, delay_ms) {
Link Here
|
| 992 |
} |
1011 |
} |
| 993 |
|
1012 |
|
| 994 |
if ( table_settings ) { |
1013 |
if ( table_settings ) { |
|
|
1014 |
|
| 1015 |
var table_key = |
| 1016 |
'DataTables_' + |
| 1017 |
table_settings['module'] +'_' + |
| 1018 |
table_settings['page'] +'_' + |
| 1019 |
table_settings['table']; |
| 1020 |
|
| 1021 |
settings["stateSave"] = true; |
| 1022 |
settings["stateSaveCallback"] = function( settings, data ) { |
| 1023 |
localStorage.setItem( table_key, JSON.stringify(data) ) |
| 1024 |
} |
| 1025 |
settings["stateLoadCallback"] = function(settings) { |
| 1026 |
return JSON.parse( localStorage.getItem(table_key) ) |
| 1027 |
} |
| 1028 |
var local_settings = localStorage.getItem(table_key); |
| 1029 |
var system_settings = table_settings["columns"]; |
| 1030 |
var columns_settings = _dt_get_saved_state(local_settings, system_settings); |
| 1031 |
|
| 995 |
if ( table_settings.hasOwnProperty('default_display_length') && table_settings['default_display_length'] != null ) { |
1032 |
if ( table_settings.hasOwnProperty('default_display_length') && table_settings['default_display_length'] != null ) { |
| 996 |
settings["pageLength"] = table_settings['default_display_length']; |
1033 |
settings["pageLength"] = table_settings['default_display_length']; |
| 997 |
} |
1034 |
} |
| 998 |
- |
|
|