Skip to content

Commit

Permalink
Core: Don't try to finish data load if there is no load result
Browse files Browse the repository at this point in the history
Fixes #94
  • Loading branch information
tabalinas committed Sep 1, 2015
1 parent 86f1cd6 commit 6be2fb7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/jsgrid.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,9 @@
});

return this._controllerCall("loadData", filter, function(loadedData) {
if(!loadedData)
return;

this._loadStrategy.finishLoad(loadedData);

this._callEventHandler(this.onDataLoaded, {
Expand Down
20 changes: 20 additions & 0 deletions tests/jsgrid.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,26 @@ $(function() {
equal(grid.option("data").length, 2, "data filtered");
});

test("filtering with static data should not do actual filtering", function() {
var $element = $("#jsGrid"),
gridOptions = {
filtering: true,
fields: [
{ type: "text", name: "field" }
],
data: [
{ name: "value1" },
{ name: "value2" }
]
},
grid = new Grid($element, gridOptions);

grid._filterRow.find("input").val("1");

grid.search();
equal(grid.option("data").length, 2, "data is not filtered");
});


module("nodatarow");

Expand Down

0 comments on commit 6be2fb7

Please sign in to comment.