Skip to content

Commit d12bf2b

Browse files
Adam Boduchjzaefferer
Adam Boduch
authored andcommitted
Make _toArray in grid accept both (observable) arrays and dataview instances (checks for result property as array). Refreshes the localDataview once.
1 parent 44bbd43 commit d12bf2b

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

grid-spf/menugrid.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,5 @@ $.widget("spf.menugrid", $.ui.grid, {
7474
} else {
7575
this.inputs.val("");
7676
}
77-
},
78-
_toArray: function() {
79-
return this.options.source.result;
8077
}
8178
});

ui/jquery.ui.grid.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ $.widget( "ui.grid", {
176176

177177
// can be customized by subwidgets
178178
_toArray: function() {
179-
return this.options.source;
179+
var source = this.options.source;
180+
return $.isArray(source.result) ? source.result : source;
180181
},
181182

182183
refresh: function() {
@@ -291,8 +292,9 @@ $.widget( "ui.grid", {
291292
if ( this.options.source ) {
292293
return;
293294
}
295+
294296
var columns = this.options.columns;
295-
// TODO source should be dataview.result; fix menugrid to deal with that
297+
296298
this.options.source = $.ui.localDataview({
297299
properties: columns,
298300
input: this._container().children().map(function() {
@@ -302,7 +304,7 @@ $.widget( "ui.grid", {
302304
});
303305
return item;
304306
}).get()
305-
});
307+
}).refresh();
306308
}
307309
});
308310

0 commit comments

Comments
 (0)