File

src/core/smart-data-source/abstract-smart-data-source.ts

Extends

ReplaySubject

Implements

ISmartDataSource ICRUDHookable IDataBoundControl

Index

Properties
Methods
Accessors

Constructor

constructor(config: AbstractSmartDataSourceConfig)
Parameters :
Name Type Optional
config AbstractSmartDataSourceConfig No

Properties

Public afterDelete
Type : AfterEventCallback

Callback function to be executed after deleting.

Public afterSaveChanges
Type : AfterEventCallback

Callback function to be executed after saving changes.

Public Optional autoFetch
Type : boolean

If set to true, the data source will automatically fetch data.

Abstract autoSelectFirstRecord
Type : boolean
Public Optional batchSize
Type : number

The batch size for fetching data.

Public beforeDelete
Type : BeforeEventCallback

Callback function to be executed before deleting.

Public beforeSaveChanges
Type : BeforeEventCallback

Callback function to be executed before saving changes.

Public Readonly config
Type : AbstractSmartDataSourceConfig
Public dataRequested
Type : DataRequestedCallback

Callback function to be executed when data is requested.

Public foreignFieldMap
Type : any
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 recordCancelled
Type : EventEmitter<boolean>
Default value : new EventEmitter<boolean>()

Emits an event when a record is cancelled The boolean indicates whether the record was being added or copied

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
Public state
Type : StateEvents
Readonly stateChanged
Type : EventEmitter<DataSourceStateChangeEventArgs>
Default value : new EventEmitter<DataSourceStateChangeEventArgs>()
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

Methods

Public Abstract addRecord
addRecord(initialValues?: Partial, atIndex?: number)
Parameters :
Name Type Optional
initialValues Partial<T> Yes
atIndex number Yes
Returns : Promise<boolean>
Public Abstract cancelAll
cancelAll()
Returns : void
Public Abstract cancelRecord
cancelRecord()
Returns : void
Public Abstract clear
clear()
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 Abstract copyRecord
copyRecord(atIndex?: number)
Parameters :
Name Type Optional
atIndex number Yes
Returns : Promise<boolean>
Public Abstract deleteRecord
deleteRecord()
Returns : Promise<void>
Public Abstract fetch
fetch(query?: IQuery)
Parameters :
Name Type Optional
query IQuery Yes
Public fetchInitialData
fetchInitialData()

Performs the initial auto-fetch using the same query shape as the constructor-time auto-fetch path.

Public getDataSource
getDataSource()

Gets the data source

the data source

Public Abstract getEmptyRecord
getEmptyRecord()
Returns : Partial<unknown>
Public getSelectedRecords
getSelectedRecords()

Returns the selected records

Returns : unknown[]

the selected records

Public Abstract saveChanges
saveChanges()
Returns : Promise<void>
Public Abstract saveRecord
saveRecord()
Returns : Promise<void>
Public Abstract selectNextRecord
selectNextRecord()
Returns : void
Public Abstract selectPreviousRecord
selectPreviousRecord()
Returns : void
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 :
Name Type Optional
active boolean No
Returns : void
Public setFilter
setFilter(value: any | any[] | string)
Parameters :
Name Type Optional
value any | any[] | string No
Returns : void
Public setNavigationDisabled
setNavigationDisabled(val: boolean, sourceDsName: string)
Parameters :
Name Type Optional
val boolean No
sourceDsName string No
Returns : void
Public setRuntimeFilter
setRuntimeFilter(value: CompositeFilterDescriptor | FilterDescriptor[] | string)
Parameters :
Name Type Optional
value CompositeFilterDescriptor | FilterDescriptor[] | string No
Returns : void
Public setSortWithoutRefresh
setSortWithoutRefresh(value: SortDescriptor[] | string)

Sets the sort order without refreshing the last query.

Parameters :
Name Type Optional Description
value SortDescriptor[] | string No
  • The sort order to store.
Returns : void
Public subscribe
subscribe(observerOrNext?: Partial<Observer<QueryResult<unknown>>> | unknown)
Parameters :
Name Type Optional
observerOrNext Partial<Observer<QueryResult<unknown>>> | unknown Yes
Returns : Subscription
Public subscribe
subscribe(next?: (value?: QueryResult) => void, error?: unknown | null, complete?: unknown | null)
Parameters :
Name Type Optional
next function Yes
error unknown | null Yes
complete unknown | null Yes
Returns : Subscription
Public subscribe
subscribe(next?: unknown, error?: unknown, complete?: unknown)

Subscribes to the data source and sets the observed flag to true.

Parameters :
Name Type Optional
next unknown Yes
error unknown Yes
complete unknown Yes
Returns : unknown
Public unsubscribe
unsubscribe()

Unsubscribes from all subscriptions and sets the observed flag to false.

Returns : void

Accessors

selected
getselected()
setselected(value: unknown)
Parameters :
Name Type Optional
value unknown No
Returns : void
selectedIndex
getselectedIndex()
setselectedIndex(value: number)
Parameters :
Name Type Optional
value number No
Returns : void
updatingRecord
getupdatingRecord()
setupdatingRecord(value: boolean)
Parameters :
Name Type Optional
value boolean No
Returns : void
copyingRecord
getcopyingRecord()
setcopyingRecord(value: boolean)
Parameters :
Name Type Optional
value boolean No
Returns : void
isCreateDisabled
getisCreateDisabled()
isUpdateDisabled
getisUpdateDisabled()
isDeleteDisabled
getisDeleteDisabled()
isReadDisabled
getisReadDisabled()
isReadOnly
getisReadOnly()
loadedRecords
getloadedRecords()
addingRecord
getaddingRecord()
Returns : boolean
setaddingRecord(value: boolean)
Parameters :
Name Type Optional
value boolean No
Returns : void
beforeImage
getbeforeImage()

The before-image (pristine, immutable copy) of the currently selected record. Returns a deep copy of _selectedCopy so callers cannot mutate the stored pristine record. A record being added or copied is a new (created) record with no before-image, matching the JSDO save convention which omits the before-image for created rows. Subclasses with editable child grids may override this to refine a child table's before-image from the child data source that tracks it.

Returns : unknown
runtimeFilters
getruntimeFilters()
Returns : any
setruntimeFilters(value: any)
Parameters :
Name Type Optional
value any No
Returns : void
parentDataSource
getparentDataSource()
Returns : ISmartDataSource
isActiveChild
getisActiveChild()

In the case of child data sources, it indicates whether the data source will react to parent data source selection changes

Returns : boolean
jsdoSchema
getjsdoSchema()
sort
getsort()

Gets the sort order that the datasource is currently using.

Returns : [] | string
setsort(value: SortDescriptor[] | string)

Sets the sort order that the datasource should use. If a query has already been made, it will be re-executed with the new setting.

Parameters :
Name Type Optional
value SortDescriptor[] | string No
Returns : void
compoundedQueryFilter
getcompoundedQueryFilter()

A filter object resulting from concatenating the data source's filter and runtimeFilters

Returns : CompositeFilterDescriptor | string
filter
getfilter()

The filter that the SmartDataSource is currently using, if any.

Returns : any | string
setfilter(value: any | string)

The filter that the SmartDataSource should use for queries. When setting the filter property, the SmartDataSource will re-execute the last query, if any.

Parameters :
Name Type Optional
value any | string No
Returns : void
parentDataSourceName
getparentDataSourceName()
Returns : string
setparentDataSourceName(val: string)
Parameters :
Name Type Optional
val string No
Returns : void
id
getid()
Returns : string
observed
getobserved()

Indicates whether the data source is currently being observed.

Returns : boolean
setobserved(value: boolean)

Sets whether the data source is currently being observed.

Parameters :
Name Type Optional
value boolean No
Returns : void

results matching ""

    No results matching ""