gridview: allow to update row data
All checks were successful
gitea-sync/antos/pipeline/head This commit looks good

This commit is contained in:
DanyLE 2023-02-17 12:25:53 +01:00
parent d1f953caf7
commit 89b95b8a37
3 changed files with 66 additions and 35 deletions

17
d.ts/antos.d.ts vendored
View File

@ -1482,6 +1482,23 @@ interface String {
*/
trimBy(arg: string): string;
}
/**
* Extend the Array prototype with some API
* functions used by AntOS API
*
* @interface Array
* @template T
*/
interface Array<T> {
/**
* Check if the array includes an element
*
* @param {T} element to check
* @returns {boolean}
* @memberof Array
*/
includes(element: T): boolean;
}
/**
* Extend the Data prototype with the
* [[timestamp]] function

View File

@ -157,6 +157,25 @@ interface String {
trimBy(arg: string): string;
}
/**
* Extend the Array prototype with some API
* functions used by AntOS API
*
* @interface Array
* @template T
*/
interface Array<T> {
/**
* Check if the array includes an element
*
* @param {T} element to check
* @returns {boolean}
* @memberof Array
*/
includes(element: T): boolean;
}
/**
* Extend the Data prototype with the
* [[timestamp]] function
@ -505,10 +524,8 @@ namespace OS {
*
* @memberof Version
*/
set version_string(v: string)
{
if(!v)
{
set version_string(v: string) {
if (!v) {
this.string = undefined;
this.major = undefined;
this.minor = undefined;
@ -526,8 +543,7 @@ namespace OS {
this.branch = 3;
if (arr.length >= 2 && br[arr[1]]) {
this.branch = br[arr[1]];
if(arr[2])
{
if (arr[2]) {
this.build_id = arr[2];
}
}
@ -551,8 +567,7 @@ namespace OS {
this.patch = Number(mt[2]);
}
}
get version_string(): string
{
get version_string(): string {
return this.string;
}

View File

@ -101,6 +101,10 @@ namespace OS {
{
this.attach(v);
}
for (let celi = 0; celi < this.children.length; celi++) {
const cel = (this.children[celi] as GridCellPrototype);
cel.data = v[celi];
}
}
get data(): GenericObject<any>[] {
return this._data;
@ -785,10 +789,6 @@ namespace OS {
for (let i = 0; i < nmin; i++) {
const rowel = (this.refs.grid.children[i] as GridRowTag);
rowel.data = rows[i];
for (let celi = 0; celi < rowel.children.length; celi++) {
const cel = (rowel.children[celi] as GridCellPrototype);
cel.data = rows[i][celi];
}
}
// remove existing remaining rows
if (ndrows < ncrows) {
@ -930,20 +930,19 @@ namespace OS {
const el = rowel[0] as GridRowTag;
rowel[0].uify(this.observable);
el.data = row;
for (let cell of row) {
let tag = this.cellitem;
if (cell.tag) {
({ tag } = cell);
tag = cell.tag;
}
const el = $(`<${tag}>`).appendTo(rowel);
const element = el[0] as GridCellPrototype;
element.uify(this.observable);
element.oncellselect = (e) => this.cellselect(e, false);
element.oncelldbclick = (e) => this.cellselect(e, true);
element.data = cell;
}
el.data = row;
el.onrowselect = (e) => this.rowselect({
id: el.aid,
data: { item: el }