{
    "componentChunkName": "component---src-templates-doc-page-jsx",
    "path": "/vue-data-grid/filter-set-api/",
    "result": {"data":{"markdownRemark":{"htmlAst":{"type":"element","tagName":"div","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"This section describes how the Set Filter can be controlled programmatically using API calls."}]},{"type":"element","tagName":"h2","properties":{"id":"set-filter-model","style":"position:relative;"},"children":[{"type":"text","value":"Set Filter Model"},{"type":"element","tagName":"a","properties":{"href":"#set-filter-model","ariaLabel":"set filter model permalink","className":["docs-header-icon","after"]},"children":[{"type":"element","tagName":"svg","properties":{"id":"icon","xmlns":"http://www.w3.org/2000/svg","viewBox":"0 0 32 32"},"children":[{"type":"element","tagName":"path","properties":{"d":"M29.25,6.76a6,6,0,0,0-8.5,0l1.42,1.42a4,4,0,1,1,5.67,5.67l-8,8a4,4,0,1,1-5.67-5.66l1.41-1.42-1.41-1.42-1.42,1.42a6,6,0,0,0,0,8.5A6,6,0,0,0,17,25a6,6,0,0,0,4.27-1.76l8-8A6,6,0,0,0,29.25,6.76Z"},"children":[]},{"type":"element","tagName":"path","properties":{"d":"M4.19,24.82a4,4,0,0,1,0-5.67l8-8a4,4,0,0,1,5.67,0A3.94,3.94,0,0,1,19,14a4,4,0,0,1-1.17,2.85L15.71,19l1.42,1.42,2.12-2.12a6,6,0,0,0-8.51-8.51l-8,8a6,6,0,0,0,0,8.51A6,6,0,0,0,7,28a6.07,6.07,0,0,0,4.28-1.76L9.86,24.82A4,4,0,0,1,4.19,24.82Z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Get and set the state of the Set Filter by getting and setting the model on the filter instance."}]},{"type":"element","tagName":"snippet","properties":{},"children":[{"type":"text","value":"\n| // get filter instance\n| const countryFilterComponent = gridOptions.api.getFilterInstance('country');\n| \n| // get filter model\n| const model = countryFilterComponent.getModel();\n| \n| // set filter model and update\n| countryFilterComponent.setModel({ values: ['Spain', 'Ireland', 'South Africa'] });\n| \n| // refresh rows based on the filter (not automatic to allow for batching multiple filters)\n| gridOptions.api.onFilterChanged();\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The filter model contains an array of string values where each item in the array corresponds to an element to be selected from the set."}]},{"type":"element","tagName":"h2","properties":{"id":"set-filter-api","style":"position:relative;"},"children":[{"type":"text","value":"Set Filter API"},{"type":"element","tagName":"a","properties":{"href":"#set-filter-api","ariaLabel":"set filter api permalink","className":["docs-header-icon","after"]},"children":[{"type":"element","tagName":"svg","properties":{"id":"icon","xmlns":"http://www.w3.org/2000/svg","viewBox":"0 0 32 32"},"children":[{"type":"element","tagName":"path","properties":{"d":"M29.25,6.76a6,6,0,0,0-8.5,0l1.42,1.42a4,4,0,1,1,5.67,5.67l-8,8a4,4,0,1,1-5.67-5.66l1.41-1.42-1.41-1.42-1.42,1.42a6,6,0,0,0,0,8.5A6,6,0,0,0,17,25a6,6,0,0,0,4.27-1.76l8-8A6,6,0,0,0,29.25,6.76Z"},"children":[]},{"type":"element","tagName":"path","properties":{"d":"M4.19,24.82a4,4,0,0,1,0-5.67l8-8a4,4,0,0,1,5.67,0A3.94,3.94,0,0,1,19,14a4,4,0,0,1-1.17,2.85L15.71,19l1.42,1.42,2.12-2.12a6,6,0,0,0-8.51-8.51l-8,8a6,6,0,0,0,0,8.51A6,6,0,0,0,7,28a6.07,6.07,0,0,0,4.28-1.76L9.86,24.82A4,4,0,0,1,4.19,24.82Z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"ISetFilter"}]},{"type":"text","value":" interface defines the public API for the Set Filter."}]},{"type":"element","tagName":"div","properties":{},"children":[{"type":"element","tagName":"interface-documentation","properties":{"interfacename":"ISetFilter","exclude":"[\"getModelFromUi\", \"applyModel\", \"doesFilterPass\", \"onNewRowsLoaded\", \"onAnyFilterChanged\", \"getModelAsString\"]","overridesrc":"filter-set-api/resources/iSetFilter.json"},"children":[]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"It is important to note that when updating the Set Filter through the API, it is up to the developer to call "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"filterInstance.applyModel()"}]},{"type":"text","value":" to apply the changes that have been made to the model and then "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"gridOptions.api.onFilterChanged()"}]},{"type":"text","value":" at the end of the interaction with the filter."}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If no call is made to "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"filterInstance.applyModel()"}]},{"type":"text","value":" then the filter UI will show any changes, but they won't be reflected in the filter model. This will appear as if the user never hit the Apply Button (regardless of whether the Apply Button is active or not)."}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If no call to "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"gridOptions.api.onFilterChanged()"}]},{"type":"text","value":" is provided the grid will still show the data relevant to the filter before it was updated through the API."}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In the example below, you can see how the filter for the Athlete column is modified through the API and how at the end of the interaction a call to "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"gridOptions.api.onFilterChanged()"}]},{"type":"text","value":" is performed."}]},{"type":"element","tagName":"div","properties":{},"children":[{"type":"element","tagName":"grid-example","properties":{"title":"Set Filter API","name":"set-filter-api","type":"mixed","options":"{ \"enterprise\": true, \"exampleHeight\": 570, \"modules\": [\"clientside\", \"setfilter\", \"menu\", \"filterpanel\"] }"},"children":[]}]},{"type":"element","tagName":"h3","properties":{"id":"enabling-case-sensitivity","style":"position:relative;"},"children":[{"type":"text","value":"Enabling Case-Sensitivity"},{"type":"element","tagName":"a","properties":{"href":"#enabling-case-sensitivity","ariaLabel":"enabling case sensitivity permalink","className":["docs-header-icon","after"]},"children":[{"type":"element","tagName":"svg","properties":{"id":"icon","xmlns":"http://www.w3.org/2000/svg","viewBox":"0 0 32 32"},"children":[{"type":"element","tagName":"path","properties":{"d":"M29.25,6.76a6,6,0,0,0-8.5,0l1.42,1.42a4,4,0,1,1,5.67,5.67l-8,8a4,4,0,1,1-5.67-5.66l1.41-1.42-1.41-1.42-1.42,1.42a6,6,0,0,0,0,8.5A6,6,0,0,0,17,25a6,6,0,0,0,4.27-1.76l8-8A6,6,0,0,0,29.25,6.76Z"},"children":[]},{"type":"element","tagName":"path","properties":{"d":"M4.19,24.82a4,4,0,0,1,0-5.67l8-8a4,4,0,0,1,5.67,0A3.94,3.94,0,0,1,19,14a4,4,0,0,1-1.17,2.85L15.71,19l1.42,1.42,2.12-2.12a6,6,0,0,0-8.51-8.51l-8,8a6,6,0,0,0,0,8.51A6,6,0,0,0,7,28a6.07,6.07,0,0,0,4.28-1.76L9.86,24.82A4,4,0,0,1,4.19,24.82Z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"By default the API is case-insensitive. You can enable case sensitivity by using the "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"caseSensitive: true"}]},{"type":"text","value":" filter parameter:"}]},{"type":"element","tagName":"snippet","properties":{},"children":[{"type":"text","value":"\nconst gridOptions = {\n    columnDefs: [\n        {\n            field: 'colour',\n            filter: 'agSetColumnFilter',\n            filterParams: {\n                caseSensitive: true\n            }\n        }\n    ]\n}\n"}]},{"type":"element","tagName":"div","properties":{"className":["custom-block","note"]},"children":[{"type":"element","tagName":"div","properties":{"className":["custom-block-body"]},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"caseSensitive"}]},{"type":"text","value":" option also affects "},{"type":"element","tagName":"a","properties":{"href":"/archive/29.3.1/filter-set-mini-filter/#enabling-case-sensitive-searches"},"children":[{"type":"text","value":"Mini-Filter"}]},{"type":"text","value":" searches and the values presented in the "},{"type":"element","tagName":"a","properties":{"href":"/archive/29.3.1/filter-set-filter-list/#enabling-value-case-sensitivity"},"children":[{"type":"text","value":"Filter List"}]},{"type":"text","value":"."}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The following example demonstrates the difference in behaviour between "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"caseSensitive: false"}]},{"type":"text","value":" (the default) and "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"caseSensitive: true"}]},{"type":"text","value":":"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"With "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"caseSensitive: false"}]},{"type":"text","value":" (the default):"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"setModel()"}]},{"type":"text","value":" will perform "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"case-insensitive"}]},{"type":"text","value":" matching against available values to decide what is enabled in the Filter List."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"setFilterValues()"}]},{"type":"text","value":" will override the available values and force the case of the presented values in the Filter List to those provided."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Selected values will be maintained based upon "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"case-insensitive"}]},{"type":"text","value":" matching."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"With "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"caseSensitive: true"}]},{"type":"text","value":":"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"setModel()"}]},{"type":"text","value":" will perform "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"case-sensitive"}]},{"type":"text","value":" matching against available values to decide what is enabled in the Filter List."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"setFilterValues()"}]},{"type":"text","value":" will override the available values and force the case of the presented values in the Filter List to those provided."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Selected values will be maintained based upon "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"case-sensitive"}]},{"type":"text","value":" matching."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"In both cases "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"getModel()"}]},{"type":"text","value":" and "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"getFilterValues()"}]},{"type":"text","value":" will return the values with casing that matches those displayed in the Filter List."}]},{"type":"text","value":"\n"}]},{"type":"element","tagName":"div","properties":{},"children":[{"type":"element","tagName":"grid-example","properties":{"title":"Set Filter API - Case Sensitivity","name":"set-filter-api-case-sensitive","type":"mixed","options":"{ \"enterprise\": true, \"exampleHeight\": 570, \"modules\": [\"clientside\", \"setfilter\", \"menu\", \"filterpanel\"] }"},"children":[]}]},{"type":"element","tagName":"h2","properties":{"id":"next-up","style":"position:relative;"},"children":[{"type":"text","value":"Next Up"},{"type":"element","tagName":"a","properties":{"href":"#next-up","ariaLabel":"next up permalink","className":["docs-header-icon","after"]},"children":[{"type":"element","tagName":"svg","properties":{"id":"icon","xmlns":"http://www.w3.org/2000/svg","viewBox":"0 0 32 32"},"children":[{"type":"element","tagName":"path","properties":{"d":"M29.25,6.76a6,6,0,0,0-8.5,0l1.42,1.42a4,4,0,1,1,5.67,5.67l-8,8a4,4,0,1,1-5.67-5.66l1.41-1.42-1.41-1.42-1.42,1.42a6,6,0,0,0,0,8.5A6,6,0,0,0,17,25a6,6,0,0,0,4.27-1.76l8-8A6,6,0,0,0,29.25,6.76Z"},"children":[]},{"type":"element","tagName":"path","properties":{"d":"M4.19,24.82a4,4,0,0,1,0-5.67l8-8a4,4,0,0,1,5.67,0A3.94,3.94,0,0,1,19,14a4,4,0,0,1-1.17,2.85L15.71,19l1.42,1.42,2.12-2.12a6,6,0,0,0-8.51-8.51l-8,8a6,6,0,0,0,0,8.51A6,6,0,0,0,7,28a6.07,6.07,0,0,0,4.28-1.76L9.86,24.82A4,4,0,0,1,4.19,24.82Z"},"children":[]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Continue to the next section to learn about "},{"type":"element","tagName":"a","properties":{"href":"/archive/29.3.1/filter-multi/"},"children":[{"type":"text","value":"Multi Filters"}]},{"type":"text","value":"."}]}]},"frontmatter":{"title":"Set Filter - API","version":null,"enterprise":true,"sideMenu":null,"description":null},"headings":[{"id":"set-filter-model","depth":2,"value":"Set Filter Model"},{"id":"set-filter-api","depth":2,"value":"Set Filter API"},{"id":"enabling-case-sensitivity","depth":3,"value":"Enabling Case-Sensitivity"},{"id":"next-up","depth":2,"value":"Next Up"}]}},"pageContext":{"frameworks":["javascript","react","angular","vue"],"framework":"vue","srcPath":"/filter-set-api","pageName":"filter-set-api"}},
    "staticQueryHashes": ["1766026005","699667431","940729948"]}