@eclipse-scout/core
Version:
Eclipse Scout runtime
106 lines • 6.18 kB
TypeScript
/// <reference types="jquery" />
import { EventHandler, LimitedResultInfoContributionDo, ObjectOrModel, Page, PageWithTableEventMap, PageWithTableModel, Table, TableAllRowsDeletedEvent, TableReloadEvent, TableReloadReason, TableRow, TableRowActionEvent, TableRowOrderChangedEvent, TableRowsDeletedEvent, TableRowsInsertedEvent, TableRowsUpdatedEvent } from '../../../index';
export declare class PageWithTable extends Page implements PageWithTableModel {
model: PageWithTableModel;
eventMap: PageWithTableEventMap;
alwaysCreateChildPage: boolean;
protected _tableRowDeleteHandler: EventHandler<TableRowsDeletedEvent | TableAllRowsDeletedEvent>;
protected _tableRowInsertHandler: EventHandler<TableRowsInsertedEvent>;
protected _tableRowUpdateHandler: EventHandler<TableRowsUpdatedEvent>;
protected _tableRowActionHandler: EventHandler<TableRowActionEvent>;
protected _tableRowOrderChangeHandler: EventHandler<TableRowOrderChangedEvent>;
protected _tableDataLoadHandler: EventHandler<TableReloadEvent>;
constructor();
protected _initDetailTable(table: Table): void;
protected _destroyDetailTable(table: Table): void;
protected _onTableRowsDeleted(event: TableRowsDeletedEvent | TableAllRowsDeletedEvent): void;
protected _onTableRowsInserted(event: TableRowsInsertedEvent): void;
protected _onTableRowsUpdated(event: TableRowsUpdatedEvent): void;
protected _onTableRowAction(event: TableRowActionEvent): void;
protected _onTableRowOrderChanged(event: TableRowOrderChangedEvent): void;
protected _createChildPageInternal(row: TableRow): Page;
/**
* Override this method to return a specific Page instance for the given table-row.
* The default impl. returns null, which means a AutoLeafPageWithNodes instance will be created for the table-row.
*/
createChildPage(row: TableRow): Page;
createDefaultChildPage(row: TableRow): Page;
loadChildren(): JQuery.Promise<any>;
protected _createSearchFilter(): any;
/**
* Adds a {@link MaxRowCountContributionDo} to the given request.
* Typically, this method should be used before sending a request in {@link _loadTableData} to attach the row limit constraints (if existing).
* The contribution is only added if there is a row limit. Otherwise, the request remains untouched.
* @example
* protected override _loadTableData(searchFilter: MyRestrictionDo): JQuery.Promise<MyResponseDo> {
* const request: MyRequestDo = {
* id: '1',
* ...
* restriction: searchFilter
* };
* return ajax.postJson(url, this._withMaxRowCountContribution(request));
* }
* @param dataObject The {@link DoEntity} to which the contribution should be added.
* @returns the resulting request with the added contribution.
*/
protected _withMaxRowCountContribution<T>(dataObject: T): T;
/**
* see Java: AbstractPageWithTable#loadChildren that's where the table is reloaded and the tree is rebuilt, called by AbstractTree#P_UIFacade
*/
loadTableData(reloadReason?: TableReloadReason): JQuery.Promise<any>;
/**
* Get info needed to restore the selection after table data was loaded.
* - {@link RestoreSelectionInfo.restoreSelection} is `true` if a child page of this page is currently selected.
* - {@link RestoreSelectionInfo.selectedRowKey} is the row key (see {@link TableRow.getKeyValues}) of the row corresponding to the direct child page of this page that is currently selected or a parent of the currently selected page.
*/
protected _getRestoreSelectionInfo(): RestoreSelectionInfo;
/**
* Restores the selection by the given {@link RestoreSelectionInfo}. If there is no selected page for the current outline, the following page will be selected:
* 1. The page corresponding to the selected row of the detail table of this page.
* 2. The page corresponding to the row found by the given former selected row key (@see {@link RestoreSelectionInfo}).
* 3. This page.
*/
protected _restoreSelection(restoreSelectionInfo?: RestoreSelectionInfo): void;
/**
* Override this method to load table data (rows to be added to table).
* This is an asynchronous operation working with a Promise. If table data load is successful,
* <code>_onLoadTableDataDone(data)</code> will be called. If a failure occurs while loading table
* data, <code>_onLoadTableDataFail(data)</code> will be called.
* <p>
* If you want to return static data, you can return a resolvedPromise:
* <code>return $.resolvedPromise([{...},{...}]);</code>
*
* @param searchFilter The search filter as exported by the search form or null.
*/
protected _loadTableData(searchFilter: any): JQuery.Promise<any>;
/**
* This method is called when table data load is successful. It should transform the table data
* object to table rows.
*
* @param tableData data loaded by <code>_loadTableData</code>
*/
protected _onLoadTableDataDone(tableData: any, restoreSelectionInfo?: RestoreSelectionInfo): void;
protected _readLimitedResultInfo(numRows: number, limitedResultInfoDo?: LimitedResultInfoContributionDo): void;
protected _getLimitedResultInfoDo(tableData: any): LimitedResultInfoContributionDo;
protected _onLoadTableDataFail(error: any, restoreSelectionInfo?: RestoreSelectionInfo): void;
protected _onLoadTableDataAlways(restoreSelectionInfo?: RestoreSelectionInfo): void;
/**
* This method converts the loaded table data, which can be any object, into table rows.
* You must override this method unless tableData is already an array of table rows.
*/
protected _transformTableDataToTableRows(tableData: any): ObjectOrModel<TableRow>[];
}
/**
* Object containing the info needed to restore the selection after table data was loaded.
*/
export type RestoreSelectionInfo = {
/**
* Whether the selection should be restored or not.
*/
restoreSelection: boolean;
/**
* Former selected row key.
*/
selectedRowKey: any[];
};
//# sourceMappingURL=PageWithTable.d.ts.map