merge with branch issue-236

This commit is contained in:
Sebastian Sdorra
2012-09-02 16:55:49 +02:00
3 changed files with 19 additions and 14 deletions

View File

@@ -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');
}
},

View File

@@ -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){

View File

@@ -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;
}
}