Invoking Named Queries using the Smart Data Source
There are two steps involved when running a Named Query using the Smart Data Source:
Get a reference of the Smart Data Source
ngOnInit() { this.datasourceRegistry.datasourceAdded.filter(event => event.datasourceName === 'customerDatasource') .subscribe(event => { this.customerDatasource = event.dataSource; }); }
Run the query
ngOnInit() { this.datasourceRegistry.datasourceAdded.filter(event => event.datasourceName === 'customerDatasource') .subscribe(event => { this.customerDatasource = event.dataSource; this.customerDatasource.namedQuery({ name: 'QuickSearch', parameters: [{ name: 'q', type: 'character', value: 'LIft' }] }).then(result => { console.log(result); }).catch(err => console.error(err)); }); }