[open-ils-commits] r11682 - trunk/Open-ILS/web/js/dojo/openils/widget
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Dec 26 14:53:54 EST 2008
Author: erickson
Date: 2008-12-26 14:53:50 -0500 (Fri, 26 Dec 2008)
New Revision: 11682
Modified:
trunk/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js
Log:
column settings are loaded and applied at page load time
Modified: trunk/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js 2008-12-26 18:49:17 UTC (rev 11681)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/GridColumnPicker.js 2008-12-26 19:53:50 UTC (rev 11682)
@@ -35,6 +35,10 @@
USER_PERSIST_SETTING : 'ui.grid_columns',
+ /**
+ * Load the fields from the grid and map them to the MenuItem's.
+ * Load settings from server
+ */
init : function(grid, persistPrefix, authtoken) {
this.grid = grid;
@@ -54,6 +58,7 @@
}
}
);
+ this.load();
},
onClose : function() {
@@ -61,6 +66,9 @@
this.persist();
},
+ /**
+ * Save new settings on the server
+ */
persist : function() {
var selected = [];
var autoFields = [];
@@ -82,7 +90,37 @@
}
}
);
- }
- }
+ },
+
+ /**
+ * Load existing settings from the server
+ */
+ load : function() {
+ var self = this;
+ fieldmapper.standardRequest(
+ ['open-ils.actor', 'open-ils.actor.patron.settings.retrieve'],
+ { async: true,
+ params: [this.authtoken, null, this.USER_PERSIST_SETTING+'.'+this.persistPrefix],
+ oncomplete: function(r) { self._loadCallback(r); }
+ }
+ );
+ },
+
+ _loadCallback : function(r) {
+ if(settings = openils.Util.readResponse(r)) {
+ dojo.forEach(this.getChildren(),
+ function(child) {
+ if(child.field) {
+ if(!openils.Util.arrayContains(settings.columns, child.field.ident)) {
+ child.attr("checked", false);
+ child.onChange(child.checked);
+ }
+ }
+ }
+ );
+ }
+ },
+
+ } // class def
);
}
More information about the open-ils-commits
mailing list