AutoGrid onItemReceived support
authorBill Erickson <berick@esilibrary.com>
Fri, 23 Mar 2012 16:04:02 +0000 (12:04 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 29 Mar 2012 14:10:24 +0000 (10:10 -0400)
Adds support for a new call-back, called when a grid row item is
received (via pcrud onresponse).  If defined, The call-back is passed
the received item before the it's added to the data store.  This allows
users to get a direct handle on received objects.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/web/js/dojo/openils/widget/AutoGrid.js

index 715a7c0..e570d98 100644 (file)
@@ -36,6 +36,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
             requiredFields : null,
             hidePaginator : false,
             showLoadFilter : false,
+            onItemReceived : null,
             suppressLinkedFields : null, // list of fields whose linked display data should not be fetched from the server
 
             /* by default, don't show auto-generated (sequence) fields */
@@ -626,6 +627,8 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                     streaming : true,
                     onresponse : function(r) {
                         var item = openils.Util.readResponse(r);
+                        if (self.onItemReceived) 
+                            self.onItemReceived(item);
                         self.store.newItem(item.toStoreItem());
                     },
                     oncomplete : function() {