This repository was archived by the owner on Jun 1, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 119
AutoComplete Filter
Ghislain B edited this page Jan 14, 2019
·
23 revisions
AutoComplete is a functionality that let the user start typing characters and the autocomplete will try to give suggestions according to the characters entered. The collection can be a JSON files (collection of strings or objects) or can also be an external resource like a JSONP query to an external API. For a demo of what that could look like, take a look at the animated gif demo below.
If you want to pass the entire list to the AutoComplete (like a JSON file or a Web API call), you can do so using the collection
or the collectionAsync
(the latter will load it asynchronously). You can also see that the Editor and Filter have almost the exact same configuration (apart from the model
that is obviously different).
<angular-slickgrid gridId="grid2"
[columnDefinitions]="columnDefinitions"
[gridOptions]="gridOptions"
[dataset]="dataset">
</angular-slickgrid>
import { Component, OnInit} from '@angular/core';
export class GridBasicComponent implements OnInit {
columnDefinitions: Column[];
gridOptions: GridOption;
dataset: any[];
ngOnInit(): void {
// your columns definition
this.columnDefinitions = [
{
id: 'countryOfOrigin', name: 'Country of Origin', field: 'countryOfOrigin',
formatter: Formatters.complexObject,
dataKey: 'code', // our list of objects has the structure { code: 'CA', name: 'Canada' }, since we want to use the code`, we will set the dataKey to "code"
labelKey: 'name', // while the displayed value is "name"
type: FieldType.object,
sorter: Sorters.objectString, // since we have set dataKey to "code" our output type will be a string, and so we can use this objectString, this sorter always requires the dataKey
filterable: true,
sortable: true,
minWidth: 100,
editor: {
model: Editors.autoComplete,
customStructure: { label: 'name', value: 'code' },
collectionAsync: this.http.get('assets/data/countries.json'), // this demo will load the JSON file asynchronously
},
filter: {
model: Filters.autoComplete,
customStructure: { label: 'name', value: 'code' },
collectionAsync: this.http.get('assets/data/countries.json'),
}
}
];
this.gridOptions = {
// your grid options config
}
}
}
Contents
- Angular-Slickgrid Uncyclo
- Installation
- Styling
- Interfaces/Models
- Testing Patterns
- Column Functionalities
- Global Grid Options
- Localization
- Events
- Grid Functionalities
- Auto-Resize / Resizer Service
- Resize by Cell Content
- Composite Editor
- Context Menu
- Custom Tooltip
- Add/Delete/Update or Highlight item
- Dynamically Change Row CSS Classes
- Excel Copy Buffer
- Export to Excel
- Export to File (CSV/Txt)
- Grid State & Presets
- Grouping & Aggregators
- Row Detail
- SlickGrid Controls
- SlickGrid Plugins
- Pinning (frozen) of Columns/Rows
- Tree Data Grid
- SlickGrid & DataView objects
- Addons (controls/plugins)
- Backend Services