setData, addData 수정

main
mjkhan21 1 year ago
parent 04d9c7ae39
commit 87702bfab8

@ -475,7 +475,7 @@ class Dataset {
this._byKeys = {}; this._byKeys = {};
this._current = null; this._current = null;
let data = this._getDataItems(obj); let data = this._getDataItems(obj = obj || {});
this._items = data.items; this._items = data.items;
this._byKeys = data.byKeys; this._byKeys = data.byKeys;
/* /*
@ -498,7 +498,6 @@ class Dataset {
} }
_getDataItems(obj) { _getDataItems(obj) {
obj = obj || {};
let array = Array.isArray(obj) ? obj : this.conf.dataGetter(obj) || []; let array = Array.isArray(obj) ? obj : this.conf.dataGetter(obj) || [];
if (!Array.isArray(array)) if (!Array.isArray(array))
throw new Error("The data must be an array"); throw new Error("The data must be an array");
@ -533,7 +532,7 @@ class Dataset {
return this.setData(obj); return this.setData(obj);
let state = this.state; let state = this.state;
let data = this._getDataItems(obj); let data = this._getDataItems(obj = obj || {});
this._items = this._items.concat(data.items); this._items = this._items.concat(data.items);
this._byKeys = { this._byKeys = {
...this._byKeys, ...this._byKeys,

Loading…
Cancel
Save