ListView: add API to scroll the list to top/bottom
All checks were successful
gitea-sync/antos/pipeline/head This commit looks good

This commit is contained in:
DanyLE 2023-02-02 21:54:47 +01:00
parent c8fbc08c63
commit d1f2861fd5
3 changed files with 65 additions and 2 deletions

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

@ -4744,6 +4744,18 @@ declare namespace OS {
* @memberof ListViewTag * @memberof ListViewTag
*/ */
protected dropoff(e: any): void; protected dropoff(e: any): void;
/**
* Scroll the list view to bottom
*
* @memberof ListViewTag
*/
scroll_to_bottom(): void;
/**
* Scroll the list view to top
*
* @memberof ListViewTag
*/
scroll_to_top(): void;
/** /**
* calibrate the list layout * calibrate the list layout
* *
@ -6316,13 +6328,25 @@ declare namespace OS {
* @memberof GridViewTag * @memberof GridViewTag
*/ */
delete(row: GridRowTag): void; delete(row: GridRowTag): void;
/**
* Scroll the grid view to bottom
*
* @memberof GridViewTag
*/
scroll_to_bottom(): void;
/**
* Scroll the grid view to top
*
* @memberof GridViewTag
*/
scroll_to_top(): void;
/** /**
* Push a row to the grid * Push a row to the grid
* *
* @param {GenericObject<any>[]} row list of cell data * @param {GenericObject<any>[]} row list of cell data
* @param {boolean} flag indicates where the row is add to beginning or end * @param {boolean} flag indicates where the row is add to beginning or end
* of the row * of the row
* @memberof GridViewTags * @memberof GridViewTag
*/ */
push(row: GenericObject<any>[], flag: boolean): void; push(row: GenericObject<any>[], flag: boolean): void;
/** /**

View File

@ -869,6 +869,25 @@ namespace OS {
} }
$(row).remove(); $(row).remove();
} }
/**
* Scroll the grid view to bottom
*
* @memberof GridViewTag
*/
scroll_to_bottom()
{
this.refs.container.scrollTo({ top: this.refs.container.scrollHeight, behavior: 'smooth' })
}
/**
* Scroll the grid view to top
*
* @memberof GridViewTag
*/
scroll_to_top()
{
this.refs.container.scrollTo({ top: 0, behavior: 'smooth' });
}
/** /**
* Push a row to the grid * Push a row to the grid
@ -876,7 +895,7 @@ namespace OS {
* @param {GenericObject<any>[]} row list of cell data * @param {GenericObject<any>[]} row list of cell data
* @param {boolean} flag indicates where the row is add to beginning or end * @param {boolean} flag indicates where the row is add to beginning or end
* of the row * of the row
* @memberof GridViewTags * @memberof GridViewTag
*/ */
push(row: GenericObject<any>[], flag: boolean): void { push(row: GenericObject<any>[], flag: boolean): void {
const rowel = $("<afx-grid-row>").css( const rowel = $("<afx-grid-row>").css(

View File

@ -1346,6 +1346,26 @@ namespace OS {
} }
} }
/**
* Scroll the list view to bottom
*
* @memberof ListViewTag
*/
scroll_to_bottom()
{
this.refs.mlist.scrollTo({ top: this.refs.mlist.scrollHeight, behavior: 'smooth' })
}
/**
* Scroll the list view to top
*
* @memberof ListViewTag
*/
scroll_to_top()
{
this.refs.mlist.scrollTo({ top: 0, behavior: 'smooth' });
}
/** /**
* calibrate the list layout * calibrate the list layout
* *