Skip to content

Commit

Permalink
allow setLocalItems of null
Browse files Browse the repository at this point in the history
  • Loading branch information
noogen committed Jan 21, 2020
1 parent a744a8a commit 6e6d634
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 13 deletions.
6 changes: 3 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"/index.js": "/index.js?id=8daa0f095eef6a843955",
"/index.js.map": "/index.js.map?id=69bf9bc699358f0e925a"
"/index.js": "/index.js?id=5cbf00264114758a7830",
"/index.js.map": "/index.js.map?id=4cb22523419a59d7d2eb"
}
4 changes: 2 additions & 2 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41697,10 +41697,10 @@ function () {
value: function setLocalItems(items) {
var that = this;
that.currentPage = 1;
that.totalRows = items.length;
that.startRow = 1;
that.endRow = that.totalRows;
that.perPage = -1;
that.totalRows = items ? items.length : -1;
that.endRow = that.totalRows;

_localItems.set(this, items);
}
Expand Down
2 changes: 1 addition & 1 deletion example/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bvtnet-items-provider",
"version": "0.9.3",
"version": "0.9.4",
"description": "datatables.net ajax items provider for bootstrap-vue b-table",
"author": "Tom Noogen",
"main": "dist/index.js",
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ class ItemsProvider {
* @param Array items list of local items
*/
setLocalItems(items) {
const that = this
const that = this
that.currentPage = 1
that.totalRows = items.length
that.startRow = 1
that.endRow = that.totalRows
that.perPage = -1
that.totalRows = items ? items.length : -1
that.endRow = that.totalRows

_localItems.set(this, items)
}
Expand Down
11 changes: 11 additions & 0 deletions tests/itemsprovider.specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,14 @@ test('ItemsProvider executeQuery returns local items', t => {
t.is(ip.perPage, -1)
t.is(items[0].name, 'test')
})

test('ItemsProvider.setLocalItems with nulls result in empty array', t => {
const ip = new ItemsProvider(null, [])
ip.setLocalItems(null)

const items = ip.getLocalItems()

t.is(items, null)
t.is(ip.totalRows, -1)
t.is(ip.perPage, -1)
})

0 comments on commit 6e6d634

Please sign in to comment.