src/core/smart-data-source/smart-datasource.ts
constructor(config: SmartDataSourceConfig)
|
||||||
|
Creates an instance of SmartDataSource.
Parameters :
|
| Public afterSaveChanges |
Type : AfterEventCallback
|
|
A callback to be executed after saving changes. |
| Public autoFetch |
Type : boolean
|
|
If set to false, prevents the Smart Data Source from auto fetching records when the filter or runtimeFilters have changed or when a selection changed event has been fired by a parent Smart Data Source, |
| Public beforeDelete |
Type : BeforeEventCallback
|
| Public beforeSaveChanges |
Type : BeforeEventCallback
|
|
A callback to be executed before saving changes. |
| clientSideCount |
Type : unknown
|
Default value : false
|
| Public dataRequested |
Type : DataRequestedCallback
|
| Public foreignFieldMap |
Type : any
|
| Public initialDataFetched |
Type : boolean
|
| Public jsdo |
Type : progress.data.JSDO
|
| Public onInitialDataFetched |
Type : EventEmitter<boolean>
|
Default value : new EventEmitter<boolean>()
|
| Public partialDataset |
Type : boolean
|
|
Indicates whether the data source currently uses partial dataset handling. This value is derived from the JSDO table reference root-table metadata. Caller-provided partialDataset configuration values are ignored. |
| Public serverSideFiltering |
Type : boolean
|
| Public serverSideSorting |
Type : unknown
|
Default value : true
|
| Public state |
Type : StateEvents
|
Default value : StateEvents.IDLE
|
| Public stateChanged |
Type : EventEmitter<DataSourceStateChangeEventArgs>
|
Default value : new EventEmitter<DataSourceStateChangeEventArgs>()
|
|
Fired when the datasource's state changes. |
| Public afterDelete |
Type : AfterEventCallback
|
|
Callback function to be executed after deleting. |
| Abstract autoSelectFirstRecord |
Type : boolean
|
| Public Optional batchSize |
Type : number
|
|
The batch size for fetching data. |
| Public Readonly config |
Type : AbstractSmartDataSourceConfig
|
| Public getInitialValues |
Type : boolean
|
| instanceName |
Type : string
|
| Public name |
| Use instanceName instead |
Type : string
|
|
The unique name by which the data source will be identified. |
| objectName |
| Use instanceName instead |
Type : string
|
| Readonly queryResultSignal |
Type : WritableSignal<QueryResult<unknown>>
|
Default value : signal({ data: [], total: 0 })
|
| Readonly selectedIndexSignal |
Type : WritableSignal<number>
|
Default value : signal(-1)
|
|
Signal for reactive selected index tracking. Automatically updated when selectionChanged emits. |
| Readonly selectedSignal |
Type : WritableSignal<unknown | null>
|
Default value : signal(null)
|
|
Signal for reactive selected record tracking. Automatically updated when selectionChanged emits. |
| selectionChanged |
Type : EventEmitter<SelectionChangedEventArgs<unknown>>
|
Default value : new EventEmitter()
|
| Public Abstract Optional skipRecords |
Type : number
|
| Readonly stateSignal |
Type : WritableSignal<StateEvents>
|
Default value : signal(
StateEvents.IDLE
)
|
|
Signal for reactive state tracking. Automatically updated when stateChanged emits. |
| Public Abstract Optional top |
Type : number
|
| Public Async addRecord | |||||||||||||||
addRecord(initialRecord?: unknown, atIndex: number)
|
|||||||||||||||
|
Adds a new record and puts the datasource in ADD_RECORD state.
Parameters :
Returns :
Promise<boolean>
|
| Public cancelAll |
cancelAll()
|
|
Returns :
void
|
| Public cancelCurrentRequest |
cancelCurrentRequest()
|
|
Cancels the current GET request, if one is ongoing
Returns :
void
|
| Public cancelRecord | ||||||||||
cancelRecord(emitSelectionChanged: unknown)
|
||||||||||
|
Cancels all changes made to the currently selected record.
Parameters :
Returns :
void
|
| Public clear |
clear()
|
|
Clears all data loaded on the client side and closes the data source's query
Returns :
void
|
| Public copyRecord | ||||||||||
copyRecord(atIndex: number)
|
||||||||||
|
Copies the currently selected record and selects the copy
Parameters :
Returns :
Promise<boolean>
|
| Public Async deleteRecord |
deleteRecord()
|
|
Deletes the currently selected record.
Returns :
Promise<void>
|
| Public Async fetch | ||||||
fetch(query?: IQuery)
|
||||||
|
Performs a read request and loads data.
Parameters :
Returns :
Promise<QueryResult>
|
| Public getABLQueryString |
getABLQueryString()
|
|
Returns the ABL query string that aggregates getFilterBasedOnParent() and compoundedQueryString.
Returns :
string
|
| Public getChildDataSource | ||||||
getChildDataSource(viewTable: string)
|
||||||
|
Parameters :
Returns :
SmartChildDataSource
{SmartChildDataSource} |
| Public getEmptyRecord |
getEmptyRecord()
|
|
Creates an empty record that adheres to the datasource's table schema.
Returns :
any
|
| Public getJSDOSchemaForTable | ||||||
getJSDOSchemaForTable(tableName: string)
|
||||||
|
Parameters :
Returns :
JSDOFieldDefinition[]
JSDOFieldDefinition[] |
| Public getRecords | ||||||||
getRecords(request: any)
|
||||||||
|
Returns parent business entity with child records if exist
Parameters :
Returns :
any
|
| Public getSmartRestrictions | ||||||||
getSmartRestrictions(jsdo: unknown)
|
||||||||
|
Parameters :
Returns :
SmartRestrictions
SmartRestrictions |
| Public Async handleError | ||||||||
handleError(request: any)
|
||||||||
|
Handles errors that occur during CRUD operations.
Parameters :
Returns :
unknown
|
| handleParentNavigationDisabled | ||||||
handleParentNavigationDisabled(navigationDisabled: boolean)
|
||||||
|
Parameters :
Returns :
void
|
| Public invokeMethod | ||||||||||||||||
invokeMethod(methodName: string, request: JSDOMethodRequest, handleErrors: unknown)
|
||||||||||||||||
|
Invokes a method that has been defined in the JSDO Catalog. An exception is thrown if the method is not defined in the catalog or if it is not of type "invoke".
Parameters :
Returns :
Promise<any>
|
| Public namedQuery | ||||||
namedQuery(query: NamedQuery)
|
||||||
|
Parameters :
Returns :
Promise<QueryResult>
Promise |
| Public refreshCurrentBatch |
refreshCurrentBatch()
|
|
Re-executes the last query.
Returns :
Promise<QueryResult>
|
| Public Async saveChanges |
saveChanges()
|
|
Save all changes made to the selected record.
Returns :
Promise<void>
|
| Public saveRecord |
saveRecord()
|
|
Returns :
Promise<void>
|
| Public selectNextRecord |
selectNextRecord()
|
|
Selects the next loaded record. If the current record is also the last one, the first loaded record is selected.
Returns :
void
|
| Public selectPreviousRecord |
selectPreviousRecord()
|
|
Selects the previous record. If the current record is also the first one, the last loaded record is selected.
Returns :
void
|
| Public setFilter | ||||||||
setFilter(value: any | any[] | string)
|
||||||||
|
Overrides the setFilter to not throw an error if ABL query strings and Kendo UI filters are mixed.
Parameters :
Returns :
void
|
| Public setNavigationDisabled |
setNavigationDisabled(val: boolean, sourceDsName: string)
|
|
Returns :
void
|
| Public setRuntimeFilter | ||||||
setRuntimeFilter(value: CompositeFilterDescriptor | FilterDescriptor[] | string)
|
||||||
|
Overrides the setRuntimeFilter to not throw an error if ABL query strings and Kendo UI filters are mixed.
Parameters :
Returns :
void
|
| Public clearAllFilters |
clearAllFilters()
|
|
Clears all initial and runtime filters
Returns :
void
|
| Public clearFilter |
clearFilter()
|
|
Clears all non-runtime filters and reapplies the last query if there is one
Returns :
void
|
| Public clearRuntimeFilter |
clearRuntimeFilter()
|
|
Clears all runtime filters and reapplies the last query if there is one
Returns :
void
|
| Public fetchInitialData |
fetchInitialData()
|
|
Performs the initial auto-fetch using the same query shape as the constructor-time auto-fetch path.
Returns :
Promise<QueryResult<unknown>>
|
| Public getDataSource |
getDataSource()
|
|
Gets the data source
Returns :
Observable<ISmartDataSource<unknown>>
the data source |
| Public getSelectedRecords |
getSelectedRecords()
|
|
Returns the selected records
Returns :
unknown[]
the selected records |
| Public setActiveChild | ||||||
setActiveChild(active: boolean)
|
||||||
|
Sets the active state of the child data source. If the data source is set to active, it will fetch data when the parent data source has a valid selection.
Parameters :
Returns :
void
|
| Public setSortWithoutRefresh | ||||||||
setSortWithoutRefresh(value: SortDescriptor[] | string)
|
||||||||
|
Sets the sort order without refreshing the last query.
Parameters :
Returns :
void
|
| Public subscribe | ||||||
subscribe(observerOrNext?: Partial<Observer<QueryResult<unknown>>> | unknown)
|
||||||
|
Parameters :
Returns :
Subscription
|
| Public unsubscribe |
unsubscribe()
|
|
Unsubscribes from all subscriptions and sets the observed flag to false.
Returns :
void
|
| stopAfter | ||||||
getstopAfter()
|
||||||
|
Returns :
number
|
||||||
setstopAfter(value: number)
|
||||||
|
Parameters :
Returns :
void
|
| totalRecords |
gettotalRecords()
|
|
The total number of records reported by the count method defined in the JSDO Catalog, or the number of loaded records if it is not defined.
Returns :
number
|
| loadedRecords |
getloadedRecords()
|
|
The total number of loaded records.
Returns :
number
|
| top |
gettop()
|
|
The maximum number of records to read in a single fetch request.
Returns :
number
|
| skipRecords |
getskipRecords()
|
|
The number of records to skip when making a fetch request.
Returns :
number
|
| hasPreviousQuery |
gethasPreviousQuery()
|
|
Returns :
boolean
|
| addingRecord |
getaddingRecord()
|
|
True if the datasource is currently adding a record.
Returns :
boolean
|
| updatingRecord | ||||||
getupdatingRecord()
|
||||||
|
True if the datasource is currently updating a record.
Returns :
boolean
|
||||||
setupdatingRecord(value: boolean)
|
||||||
|
Parameters :
Returns :
void
|
| copyingRecord |
getcopyingRecord()
|
|
True if the datasource is currently copying a record.
Returns :
boolean
|
| navigationDisabled |
getnavigationDisabled()
|
|
Returns :
boolean
|
| beforeImage |
getbeforeImage()
|
|
The before-image of the currently selected record, including the before-image of each child/view table. The cloned _selectedCopy already carries the pristine view-table data nested at selection time; for an editable child grid that tracks its own before-state, prefer that SmartChildDataSource's before-image when it has one. Returns an immutable copy.
Returns :
any
|
| selected | ||||||
getselected()
|
||||||
|
The currently selected record, if any
Returns :
any
|
||||||
setselected(value: any)
|
||||||
|
Sets the currently selected record.
Parameters :
Returns :
void
|
| selectedIndex | ||||||
getselectedIndex()
|
||||||
|
Gets the index of the currently selected record.
Returns :
number
|
||||||
setselectedIndex(value: number)
|
||||||
|
Sets the current selected record index and updates the selection accordingly.
Parameters :
Returns :
void
|
| primaryKeys |
getprimaryKeys()
|
|
The primary keys of the datasource's referenced table.
Returns :
string[]
|
| jsdoSchema |
getjsdoSchema()
|
|
Gets the underlying JSDO schema
Returns :
JSDOFieldDefinition[]
|
| viewTables |
getviewTables()
|
|
The view tables that the underlying JSDO is using
Returns :
string[]
|
| runtimeFilters | ||||||
getruntimeFilters()
|
||||||
|
Returns :
CompositeFilterDescriptor | [] | string
|
||||||
setruntimeFilters(value: CompositeFilterDescriptor | FilterDescriptor[] | string)
|
||||||
|
Parameters :
Returns :
void
|
| tables |
gettables()
|
|
Returns :
any
|
| tableRef |
gettableRef()
|
|
Returns :
string
|
| isReadOnly |
getisReadOnly()
|
|
Returns :
boolean
|
| isReadDisabled |
getisReadDisabled()
|
|
Returns :
boolean
|
| isCreateDisabled |
getisCreateDisabled()
|
|
Returns :
boolean
|
| isUpdateDisabled |
getisUpdateDisabled()
|
|
Returns :
boolean
|
| isDeleteDisabled |
getisDeleteDisabled()
|
|
Returns :
boolean
|
| autoSelectFirstRecord | ||||||
getautoSelectFirstRecord()
|
||||||
|
Indicates whether the Smart Data Source should automatically select the first record after fetching data
Returns :
boolean
|
||||||
setautoSelectFirstRecord(value: boolean)
|
||||||
|
Indicates whether the Smart Data Source should automatically select the first record after fetching data
Parameters :
Returns :
void
|