From 80eb0f71ca8696f9fb790f713f1539c1475e7022 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 31 Aug 2012 17:17:15 +0200 Subject: [PATCH 1/2] fix some ie callback errors --- .../resources/js/rest/sonia.rest.formpanel.js | 4 +++- .../webapp/resources/js/rest/sonia.rest.grid.js | 16 ++++++++++++---- .../main/webapp/resources/js/util/sonia.util.js | 13 ++++--------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/rest/sonia.rest.formpanel.js b/scm-webapp/src/main/webapp/resources/js/rest/sonia.rest.formpanel.js index 2bf7d3c2a9..4ae530c0bd 100644 --- a/scm-webapp/src/main/webapp/resources/js/rest/sonia.rest.formpanel.js +++ b/scm-webapp/src/main/webapp/resources/js/rest/sonia.rest.formpanel.js @@ -94,8 +94,10 @@ Sonia.rest.FormPanel = Ext.extend(Ext.FormPanel,{ execCallback: function(obj, item){ if ( Ext.isFunction( obj ) ){ obj(item); - } else if ( Ext.isObject( obj )){ + } else if ( Ext.isObject( obj ) && Ext.isFunction(obj.fn) ){ obj.fn.call( obj.scope, item ); + } else if (debug){ + console.debug('obj ' + obj + ' is not valid callback object'); } }, diff --git a/scm-webapp/src/main/webapp/resources/js/rest/sonia.rest.grid.js b/scm-webapp/src/main/webapp/resources/js/rest/sonia.rest.grid.js index 2c4e1a684a..bf5a167adf 100644 --- a/scm-webapp/src/main/webapp/resources/js/rest/sonia.rest.grid.js +++ b/scm-webapp/src/main/webapp/resources/js/rest/sonia.rest.grid.js @@ -90,10 +90,18 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, { if ( debug ){ console.debug('reload store'); } - this.store.load({ - callback: callback, - scope: scope - }); + + if ( Ext.isFunction(callback) ){ + this.store.load({ + callback: callback, + scope: scope + }); + } else { + if (debug){ + console.debug( 'callback is not a function' ); + } + this.store.load(); + } }, selectionChanged: function(sm){ diff --git a/scm-webapp/src/main/webapp/resources/js/util/sonia.util.js b/scm-webapp/src/main/webapp/resources/js/util/sonia.util.js index 4f80ed7b09..87e4709484 100644 --- a/scm-webapp/src/main/webapp/resources/js/util/sonia.util.js +++ b/scm-webapp/src/main/webapp/resources/js/util/sonia.util.js @@ -169,18 +169,13 @@ Sonia.util.apply = function(obj, p){ if (!Array.prototype.filter) { Array.prototype.filter = function(fn, scope){ - var results = [], - i = 0, - ln = array.length; - - for (; i < ln; i++) { - if (fn.call(scope, array[i], i, array)) { - results.push(array[i]); + var results = []; + for (var i=0; i < this.length; i++) { + if (fn.call(scope, this[i], i, this)) { + results.push(this[i]); } } - return results; - } } \ No newline at end of file From 8e81fe723bcc7ad30ff99fe41d740625e6cf90ce Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 2 Sep 2012 16:55:18 +0200 Subject: [PATCH 2/2] close branch issue-236