Dataset.setData(), clear() 수정

master
mjkhan21 2 months ago
parent f502c0db1a
commit be2216dff5

@ -543,11 +543,16 @@ class Dataset {
}
_getDataItems(obj, option) {
obj = obj || {};
obj = obj || [];
let array = Array.isArray(obj) ? obj : null;
if (!array && this.conf.dataGetter)
array = this.conf.dataGetter(obj) || [];
array = array || [];
/*
let array = Array.isArray(obj) ? obj : this.conf.dataGetter(obj) || [];
if (!Array.isArray(array))
throw new Error("The data must be an array");
*/
let prefix = "ndx-" + new Date().getTime(),
_items = array.map(e => new DataItem(e, this._formats)),
_byKeys = {},
@ -684,7 +689,7 @@ class Dataset {
* @returns {Dataset} the Dataset
*/
clear() {
this.setData(null);
this.setData([]);
return this;
}
@ -1452,7 +1457,7 @@ class Dataset {
}
class DatasetControl {
constructor(conf) {
constructor(conf = {}) {
this.prefix = conf.prefix;
this.prefixName = conf.prefixName;
// this.doctx = conf.doctx || "";
@ -1726,6 +1731,10 @@ class DatasetControl {
this.reload({prev: selected.length == this.dataset.length});
}
clear() {
this.dataset.clear();
}
selector(selector) {
return this.doq.selector(selector);
}

Loading…
Cancel
Save