[open-ils-commits] [GIT] Evergreen ILS branch master updated. c7c418a87d2284423f58a0d3e1a418c32a8b4ab6

Evergreen Git git at git.evergreen-ils.org
Sat Mar 31 22:51:12 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  c7c418a87d2284423f58a0d3e1a418c32a8b4ab6 (commit)
      from  35169cd0fe5383c5b6a704da5d78ed42bde69c7b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c7c418a87d2284423f58a0d3e1a418c32a8b4ab6
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu Mar 29 15:15:24 2012 -0400

    AutoGrid retains external search filters
    
    AutoGrid now caches the search passed to the most recent loadAll call
    separately from any filters passed via PCrudFilterDialog.  This allows
    AutoGrid to retain externally-supplied (persistent) filters (e.g.
    context org unit selector) while being able to easily remove filters
    passed via the filter dialog.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
index 4ea8178..12c2ef2 100644
--- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
+++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
@@ -103,11 +103,20 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                                 href : 'javascript:void(0);', 
                                 onclick : function() { 
                                     if (!self.filterDialog) {
+
                                         self.filterDialog = new openils.widget.PCrudFilterDialog(
                                             {fmClass:self.fmClass, suppressFilterFields:self.suppressFilterFields})
+
                                         self.filterDialog.onApply = function(filter) {
-                                            self.refresh(self.cachedQueryOpts, filter);
+                                            self.cachedQuerySearch = dojo.mixin( filter, self.preFilterSearch );
+                                            self.resetStore();
+                                            self.loadAll(
+                                                dojo.mixin( { offset : 0 }, self.cachedQueryOpts ),
+                                                self.cachedQuerySearch,
+                                                true
+                                            );
                                         };
+
                                         self.filterDialog.startup();
                                     }
                                     self.filterDialog.show();
@@ -511,7 +520,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                 }
             },
 
-            loadAll : function(opts, search) {
+            loadAll : function(opts, search, filter_triggered) {
                 var _this = this;
 
                 // first we have to load the column picker to determine the sort fields.
@@ -535,10 +544,10 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                 }
 
                 // column picker not wanted or already loaded
-                this._loadAll(opts, search);
+                this._loadAll(opts, search, filter_triggered);
             },
 
-            _loadAll : function(opts, search) {
+            _loadAll : function(opts, search, filter_triggered) {
                 var self = this;
 
                 dojo.require('openils.PermaCrud');
@@ -565,6 +574,11 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
 
                 this.cachedQuerySearch = search;
                 this.cachedQueryOpts = opts;
+
+                // retain the most recent external loadAll 
+                if (!filter_triggered || !this.preFilterSearch)
+                    this.preFilterSearch = dojo.clone( this.cachedQuerySearch );
+
                 if(search)
                     new openils.PermaCrud().search(this.fmClass, search, opts);
                 else

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/web/js/dojo/openils/widget/AutoGrid.js |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list