@slickgrid-universal/sql
v10.5.2
Published
SlickGrid Universal SQL Backend Service (implements BackendService for SQL)
Readme
SQL Service
@slickgrid-universal/sql
SQL Service to sync a grid with native SQL queries, the service will consider any Filter/Sort and automatically build the necessary cross-platform SQL query string that is sent to your backend server.
External Dependencies
No external dependency
Installation
Follow the instruction provided in the main README, you can see a demo by looking at the GitHub Demo page.
Usage
Simply use pass the Service into the backendServiceApi Grid Option.
ViewModel
import { SqlService, type SqlServiceApi } from '@slickgrid-universal/sql';
export class MyExample {
initializeGrid {
this.gridOptions = {
backendServiceApi: {
service: new SqlService(),
options: {
tableName: 'users',
// datasetName: 'public', // optional, for schema/database
// totalCountField: 'total_count' // optional, custom field name for total count column (default: 'totalCount')
// identifierEscapeStyle: 'backtick', // optional style (backtick, doubleQuote, bracket)
},
preProcess: () => this.displaySpinner(true),
process: (query) => this.getCustomerApiCall(query),
postProcess: (response) => {
this.displaySpinner(false);
this.getCustomerCallback(response);
}
} satisfies SqlServiceApi<MyRowType>
}
}
}