mirror of
				https://github.com/lxsang/antos-frontend.git
				synced 2025-10-31 02:15:47 +01:00 
			
		
		
		
	gridview: allow to update row data
This commit is contained in:
		
							
								
								
									
										17
									
								
								d.ts/antos.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								d.ts/antos.d.ts
									
									
									
									
										vendored
									
									
								
							| @@ -1482,6 +1482,23 @@ interface String { | |||||||
|      */ |      */ | ||||||
|     trimBy(arg: string): 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 |  * Extend the Data prototype with the | ||||||
|  * [[timestamp]] function |  * [[timestamp]] function | ||||||
|   | |||||||
| @@ -157,6 +157,25 @@ interface String { | |||||||
|     trimBy(arg: string): 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 |  * Extend the Data prototype with the | ||||||
|  * [[timestamp]] function |  * [[timestamp]] function | ||||||
| @@ -505,10 +524,8 @@ namespace OS { | |||||||
|          *  |          *  | ||||||
|          * @memberof Version |          * @memberof Version | ||||||
|          */ |          */ | ||||||
|         set version_string(v: string) |         set version_string(v: string) { | ||||||
|         { |             if (!v) { | ||||||
|             if(!v) |  | ||||||
|             { |  | ||||||
|                 this.string = undefined; |                 this.string = undefined; | ||||||
|                 this.major = undefined; |                 this.major = undefined; | ||||||
|                 this.minor = undefined; |                 this.minor = undefined; | ||||||
| @@ -526,8 +543,7 @@ namespace OS { | |||||||
|             this.branch = 3; |             this.branch = 3; | ||||||
|             if (arr.length >= 2 && br[arr[1]]) { |             if (arr.length >= 2 && br[arr[1]]) { | ||||||
|                 this.branch = br[arr[1]]; |                 this.branch = br[arr[1]]; | ||||||
|                 if(arr[2]) |                 if (arr[2]) { | ||||||
|                 { |  | ||||||
|                     this.build_id = arr[2]; |                     this.build_id = arr[2]; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @@ -551,8 +567,7 @@ namespace OS { | |||||||
|                 this.patch = Number(mt[2]); |                 this.patch = Number(mt[2]); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         get version_string(): string |         get version_string(): string { | ||||||
|         { |  | ||||||
|             return this.string; |             return this.string; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -101,6 +101,10 @@ namespace OS { | |||||||
|                     { |                     { | ||||||
|                         this.attach(v); |                         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>[] { |                 get data(): GenericObject<any>[] { | ||||||
|                     return this._data; |                     return this._data; | ||||||
| @@ -785,10 +789,6 @@ namespace OS { | |||||||
|                     for (let i = 0; i < nmin; i++) { |                     for (let i = 0; i < nmin; i++) { | ||||||
|                         const rowel = (this.refs.grid.children[i] as GridRowTag); |                         const rowel = (this.refs.grid.children[i] as GridRowTag); | ||||||
|                         rowel.data = rows[i]; |                         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 |                     // remove existing remaining rows | ||||||
|                     if (ndrows < ncrows) { |                     if (ndrows < ncrows) { | ||||||
| @@ -930,20 +930,19 @@ namespace OS { | |||||||
|  |  | ||||||
|                     const el = rowel[0] as GridRowTag; |                     const el = rowel[0] as GridRowTag; | ||||||
|                     rowel[0].uify(this.observable); |                     rowel[0].uify(this.observable); | ||||||
|                     el.data = row; |  | ||||||
|                      |                      | ||||||
|                     for (let cell of row) { |                     for (let cell of row) { | ||||||
|                         let tag = this.cellitem; |                         let tag = this.cellitem; | ||||||
|                         if (cell.tag) { |                         if (cell.tag) { | ||||||
|                             ({ tag } = cell); |                             tag = cell.tag; | ||||||
|                         } |                         } | ||||||
|                         const el = $(`<${tag}>`).appendTo(rowel); |                         const el = $(`<${tag}>`).appendTo(rowel); | ||||||
|                         const element = el[0] as GridCellPrototype; |                         const element = el[0] as GridCellPrototype; | ||||||
|                         element.uify(this.observable); |                         element.uify(this.observable); | ||||||
|                         element.oncellselect = (e) => this.cellselect(e, false); |                         element.oncellselect = (e) => this.cellselect(e, false); | ||||||
|                         element.oncelldbclick = (e) => this.cellselect(e, true); |                         element.oncelldbclick = (e) => this.cellselect(e, true); | ||||||
|                         element.data = cell; |  | ||||||
|                     } |                     } | ||||||
|  |                     el.data = row; | ||||||
|                     el.onrowselect = (e) => this.rowselect({ |                     el.onrowselect = (e) => this.rowselect({ | ||||||
|                         id: el.aid, |                         id: el.aid, | ||||||
|                         data: { item: el } |                         data: { item: el } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user