changing filter dynamically
Hi,
I am trying to change the column filters dynamically. To do this, I have added menu items to the column menu of the form:
title: "contains", action: function() { newCol.filter = {condition: uiGridConstants.filter.CONTAINS, placeholder: 'contains'}}
When I select the contains item from the column menu, the placeholder changes in the filter input field, but it still only filters using the start with condition, which I set as the default (before the user chooses any of the dropdown options). Can anyone help me figure out why the condition of the filter input box isn't updating?
Thanks in advance
What is newCol? Is it a gridCol, or is it a colDef? On the gridCol, you probably want to use filters[0] rather than filter.
It looks to me like you're replacing the filter object - you're assigning a new object { condition...., placeholder....} to it. If you instead do:
newCol.filter.condition = uiGridConstants.filter.CONTAINS;
newCol.filter.placeholder = 'contains';
Then you'll update the existing object, and it's more likely to work.
Answer given, no response for some months. Closing.