Persist column visbility per user and per module (#563)

This commit is contained in:
jekkos committed 2016-05-18 08:49:28 +02:00
1 parent fc2d5e89f0
commit ea77980bff
6 files changed
+39 -6

No files matched your search

+1
View File
@@ -34,6 +34,7 @@ $(document).ready(function()
<?php $this->load->view('partial/bootstrap_tables_locale'); ?>
table_support.init({
employee_id: <?php echo $this->Employee->get_logged_in_employee_info()->person_id; ?>,
resource: '<?php echo site_url($controller_name);?>',
headers: <?php echo $table_headers; ?>,
pageSize: <?php echo $this->config->item('lines_per_page'); ?>,
+1 -1
View File
@@ -64,7 +64,7 @@
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=fb16e96753"/>
<!-- end mincss template tags -->
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=52c5b53668" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=5caa0fe77d" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>
+17 -1
View File
@@ -44603,7 +44603,6 @@ THE SOFTWARE.*/
message: (function() {
var node = $('<div></div>');
$.get($link.attr('href') || $link.data('href'), function(data) {
console.log("getting data from " + ($link.attr('href') || $link.data('href')));
node.html(data);
});
return node;
@@ -44722,6 +44721,15 @@ THE SOFTWARE.*/
var options;
var toggle_column_visbility = function() {
if (localStorage[options.employee_id]) {
var user_settings = JSON.parse(localStorage[options.employee_id]);
user_settings[options.resource] && $.each(user_settings[options.resource], function(index, element) {
element ? table().showColumn(index) : table().hideColumn(index);
});
}
};
var init = function (_options) {
options = _options;
enable_actions = enable_actions(options.enableActions);
@@ -44744,6 +44752,13 @@ THE SOFTWARE.*/
onCheckAll: enable_actions,
onUncheckAll: enable_actions,
onLoadSuccess: load_success(options.onLoadSuccess),
onColumnSwitch : function(field, checked) {
var user_settings = localStorage[options.employee_id];
user_settings = (user_settings && JSON.parse(user_settings)) || {};
user_settings[options.resource] = user_settings[options.resource] || {};
user_settings[options.resource][field] = checked;
localStorage[options.employee_id] = JSON.stringify(user_settings);
},
queryParamsType: 'limit',
iconSize: 'sm',
silentSort: true,
@@ -44751,6 +44766,7 @@ THE SOFTWARE.*/
}));
enable_actions();
init_delete();
toggle_column_visbility();
};
var init_delete = function (confirmMessage) {
+2 -2
View File
File diff suppressed because one or more lines are too long.
+17 -1
View File
@@ -70,7 +70,6 @@
message: (function() {
var node = $('<div></div>');
$.get($link.attr('href') || $link.data('href'), function(data) {
console.log("getting data from " + ($link.attr('href') || $link.data('href')));
node.html(data);
});
return node;
@@ -189,6 +188,15 @@
var options;
var toggle_column_visbility = function() {
if (localStorage[options.employee_id]) {
var user_settings = JSON.parse(localStorage[options.employee_id]);
user_settings[options.resource] && $.each(user_settings[options.resource], function(index, element) {
element ? table().showColumn(index) : table().hideColumn(index);
});
}
};
var init = function (_options) {
options = _options;
enable_actions = enable_actions(options.enableActions);
@@ -211,6 +219,13 @@
onCheckAll: enable_actions,
onUncheckAll: enable_actions,
onLoadSuccess: load_success(options.onLoadSuccess),
onColumnSwitch : function(field, checked) {
var user_settings = localStorage[options.employee_id];
user_settings = (user_settings && JSON.parse(user_settings)) || {};
user_settings[options.resource] = user_settings[options.resource] || {};
user_settings[options.resource][field] = checked;
localStorage[options.employee_id] = JSON.stringify(user_settings);
},
queryParamsType: 'limit',
iconSize: 'sm',
silentSort: true,
@@ -218,6 +233,7 @@
}));
enable_actions();
init_delete();
toggle_column_visbility();
};
var init_delete = function (confirmMessage) {
+1 -1
View File
@@ -65,7 +65,7 @@
<!-- end mincss template tags -->
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/style.css"/>
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=52c5b53668" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=5caa0fe77d" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>