Lines 883-888
function _dt_add_filters(table_node, table_dt, filters_options = {}) {
Link Here
|
883 |
} ); |
883 |
} ); |
884 |
} |
884 |
} |
885 |
|
885 |
|
|
|
886 |
function _dt_get_saved_state( localstorage_config, columns_settings ){ |
887 |
var tables = JSON.parse( localstorage_config ); |
888 |
// if a table configuration was found in local storage, parse it |
889 |
if( tables ){ |
890 |
var stateSave_column_visibility = []; |
891 |
$(tables.columns).each(function(){ |
892 |
stateSave_column_visibility.push( this.visible === true ? 0 : 1 ); |
893 |
}); |
894 |
$.each( columns_settings, function( index, key ){ |
895 |
if( stateSave_column_visibility[ index ] !== columns_settings[key] ){ |
896 |
columns_settings[ index ].is_hidden = stateSave_column_visibility[ index ]; |
897 |
} |
898 |
}); |
899 |
return columns_settings; |
900 |
} else { |
901 |
return columns_settings; |
902 |
} |
903 |
} |
886 |
|
904 |
|
887 |
(function($) { |
905 |
(function($) { |
888 |
|
906 |
|
Lines 937-942
function _dt_add_filters(table_node, table_dt, filters_options = {}) {
Link Here
|
937 |
} |
955 |
} |
938 |
|
956 |
|
939 |
if ( table_settings ) { |
957 |
if ( table_settings ) { |
|
|
958 |
|
959 |
var table_key = |
960 |
'DataTables_' + |
961 |
table_settings['module'] +'_' + |
962 |
table_settings['page'] +'_' + |
963 |
table_settings['table']; |
964 |
|
965 |
settings["stateSave"] = true; |
966 |
settings["stateSaveCallback"] = function( settings, data ) { |
967 |
localStorage.setItem( table_key, JSON.stringify(data) ) |
968 |
} |
969 |
settings["stateLoadCallback"] = function(settings) { |
970 |
return JSON.parse( localStorage.getItem(table_key) ) |
971 |
} |
972 |
var local_settings = localStorage.getItem(table_key); |
973 |
var system_settings = table_settings["columns"]; |
974 |
var columns_settings = _dt_get_saved_state(local_settings, system_settings); |
975 |
|
940 |
if ( table_settings.hasOwnProperty('default_display_length') && table_settings['default_display_length'] != null ) { |
976 |
if ( table_settings.hasOwnProperty('default_display_length') && table_settings['default_display_length'] != null ) { |
941 |
settings["pageLength"] = table_settings['default_display_length']; |
977 |
settings["pageLength"] = table_settings['default_display_length']; |
942 |
} |
978 |
} |
943 |
- |
|
|