File

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

Extends

BehaviorSubject

Implements

ICRUDHookable

Example

Index

Properties
Methods
Accessors

Constructor

constructor(jsdo: progress.data.JSDO, name: string, initialFilter: any | string, initialSort: SortDescriptor[], injector?: Injector, partialDataset)

Creates an instance of SmartDataSource.

Parameters :
Name Type Optional
jsdo progress.data.JSDO No
name string No
initialFilter any | string No
initialSort SortDescriptor[] No
injector Injector Yes
partialDataset No

Properties

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 beforeSaveChanges
Type : BeforeEventCallback

A callback to be executed before saving changes.

clientSideCount
Default value : false
Public foreignFieldMap
Type : any
Public id
Type : string
Public jsdo
Type : progress.data.JSDO
Public parentDataSourceName
Type : string
Public partialDataset
Default value : false
Public selectionChanged
Type : BehaviorSubject<SelectionChangedEventArgs>
Default value : new BehaviorSubject(null)

Fired when the selection is changed.

Public serverSideFiltering
Type : boolean
Public serverSideSorting
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 useInitialValues
Default value : false

Methods

Public addRecord
addRecord(initialRecord?: any)

Adds a new record and puts the datasource in ADD_RECORD state.

Parameters :
Name Type Optional
initialRecord any Yes
Returns : Promise<boolean>
Public cancelRecord
cancelRecord()

Cancels all changes made to the currently selected record.

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 deleteRecord
deleteRecord()

Deletes the currently selected record.

Returns : Promise<void>
Public fetch
fetch(query?: IQuery)

Performs a read request and loads data.

Parameters :
Name Type Optional
query IQuery Yes
Public getEmptyRecord
getEmptyRecord()

Creates an empty record that adheres to the datasource's table schema.

Returns : any
Public getJSDOSchemaForTable
getJSDOSchemaForTable(tableName: string)
Parameters :
Name Type Optional
tableName string No

JSDOFieldDefinition[]

Public getSmartRestrictions
getSmartRestrictions()
Returns : SmartRestrictions

SmartRestrictions

Public Async handleError
handleError(request: any)
Parameters :
Name Type Optional
request any No
Returns : {}
Public invokeMethod
invokeMethod(methodName: string, request: JSDOMethodRequest, handleErrors)

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 :
Name Type Optional Default value
methodName string No
request JSDOMethodRequest No
handleErrors No true
Returns : Promise<any>
Public namedQuery
namedQuery(query: NamedQuery)
Parameters :
Name Type Optional
query NamedQuery No

Promise

Public refreshCurrentBatch
refreshCurrentBatch()

Re-executes the last query.

Public saveChanges
saveChanges()

Save all changes made to the selected record.

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)
Parameters :
Name Type Optional
value any | any[] | string No
Returns : void
Public setRuntimeFilter
setRuntimeFilter(value: CompositeFilterDescriptor | FilterDescriptor[] | string)
Parameters :
Name Type Optional
value CompositeFilterDescriptor | FilterDescriptor[] | string No
Returns : void

Accessors

compoundedQueryFilter
getcompoundedQueryFilter()

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

Returns : CompositeFilterDescriptor | string
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
filter
getfilter()

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

Returns : any | string
setfilter(value)

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 Optional
value No
Returns : void
hasPreviousQuery
gethasPreviousQuery()
Returns : boolean
updatingRecord
getupdatingRecord()
Returns : boolean
setupdatingRecord(value: boolean)
Parameters :
Name Type Optional
value boolean No
Returns : void
addingRecord
getaddingRecord()

True if the datasource is currently adding a record.

Returns : boolean
selected
getselected()

The currently selected record, if any

Returns : any
setselected(value: any)

Sets the currently selected record.

Parameters :
Name Type Optional
value any No
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 :
Name Type Optional
value number No
Returns : void
primaryKeys
getprimaryKeys()

The primary keys of the datasource's referenced table.

Returns : string[]
sort
getsort()

Gets the sort order that the datasource is currently using.

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

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 [] No
Returns : void
jsdoSchema
getjsdoSchema()

Gets the underlying JSDO schema

viewTables
getviewTables()

The view tables that the underlying JSDO is using

Returns : string[]
runtimeFilters
getruntimeFilters()
Returns : CompositeFilterDescriptor | [] | string
setruntimeFilters(value)
Parameters :
Name Optional
value No
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
name
getname()
Returns : string

result-matching ""

    No results matching ""