|
|
@ -543,11 +543,16 @@ class Dataset {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_getDataItems(obj, option) {
|
|
|
|
_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) || [];
|
|
|
|
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");
|
|
|
|
|
|
|
|
*/
|
|
|
|
let prefix = "ndx-" + new Date().getTime(),
|
|
|
|
let prefix = "ndx-" + new Date().getTime(),
|
|
|
|
_items = array.map(e => new DataItem(e, this._formats)),
|
|
|
|
_items = array.map(e => new DataItem(e, this._formats)),
|
|
|
|
_byKeys = {},
|
|
|
|
_byKeys = {},
|
|
|
@ -684,7 +689,7 @@ class Dataset {
|
|
|
|
* @returns {Dataset} the Dataset
|
|
|
|
* @returns {Dataset} the Dataset
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
clear() {
|
|
|
|
clear() {
|
|
|
|
this.setData(null);
|
|
|
|
this.setData([]);
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1452,7 +1457,7 @@ class Dataset {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class DatasetControl {
|
|
|
|
class DatasetControl {
|
|
|
|
constructor(conf) {
|
|
|
|
constructor(conf = {}) {
|
|
|
|
this.prefix = conf.prefix;
|
|
|
|
this.prefix = conf.prefix;
|
|
|
|
this.prefixName = conf.prefixName;
|
|
|
|
this.prefixName = conf.prefixName;
|
|
|
|
// this.doctx = conf.doctx || "";
|
|
|
|
// this.doctx = conf.doctx || "";
|
|
|
@ -1726,6 +1731,10 @@ class DatasetControl {
|
|
|
|
this.reload({prev: selected.length == this.dataset.length});
|
|
|
|
this.reload({prev: selected.length == this.dataset.length});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clear() {
|
|
|
|
|
|
|
|
this.dataset.clear();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
selector(selector) {
|
|
|
|
selector(selector) {
|
|
|
|
return this.doq.selector(selector);
|
|
|
|
return this.doq.selector(selector);
|
|
|
|
}
|
|
|
|
}
|
|
|
|