</div>
</div>
+<div class="mt-4 mb-4">
+ <h4>Grid Stock Selector Display and Filtering</h4>
+ <eg-grid #eventsGrid idlClass="atevdef"
+ [dataSource]="eventsDataSource"
+ showFields="name,hook,validator,reactor"
+ [sortable]="true" [filterable]="true">
+ <!-- demo how explicit fields and auto fields support link field selector
+ display and filtering consisently without additional biolerplate -->
+ <eg-grid-column name="name"></eg-grid-column>
+ <eg-grid-column name="hook"></eg-grid-column>
+ </eg-grid>
+</div>
btSource: GridDataSource = new GridDataSource();
acpSource: GridDataSource = new GridDataSource();
+ eventsDataSource: GridDataSource = new GridDataSource();
editSelected: (rows: IdlObject[]) => void;
@ViewChild('acpGrid', { static: true }) acpGrid: GridComponent;
@ViewChild('acpEditDialog', { static: true }) editDialog: FmRecordEditorComponent;
});
};
+ this.eventsDataSource.getRows = (pager: Pager, sort: any[]) => {
+
+ const orderEventsBy: any = {atevdef: 'name'};
+ if (sort.length) {
+ orderEventsBy.atevdef = sort[0].name + ' ' + sort[0].dir;
+ }
+
+ const base: Object = {};
+ base[this.idl.classes['atevdef'].pkey] = {'!=' : null};
+ const query: any = new Array();
+ query.push(base);
+
+ Object.keys(this.eventsDataSource.filters).forEach(key => {
+ Object.keys(this.eventsDataSource.filters[key]).forEach(key2 => {
+ query.push(this.eventsDataSource.filters[key][key2]);
+ });
+ });
+
+ return this.pcrud.search('atevdef', query, {
+ flesh: 1,
+ flesh_fields: {atevdef: ['hook', 'validator', 'reactor']},
+ offset: pager.offset,
+ limit: pager.limit,
+ order_by: orderEventsBy
+ });
+ };
+
this.editSelected = (idlThings: IdlObject[]) => {
// Edit each IDL thing one at a time