I have the following filter that works as it should on the “ACCOUNTNAME” column :
<tr ng-repeat="record in records |filter:paginate|filter:{ACCOUNTNUMBER:searchText}">
I also have a ng-model /variable ‘seletcedCol’ that gets the selected Column and is displayed with the correct data using {{selectedCol}}.
Here are the two models I have for the searchText and selectedCol.
<select id="selectedCol" ng-model="selectedCol" ng-options="column for column in columns|orderBy:'toString()'"><option value="">--Select One--</option></select>
<input id="searchText" ng-model="searchText" type="text" placeholder="Search" />
I’m trying to use selectedCol in the filter instead of the column name(hardcoded) , but it doesn’t work correctly…any idea why this wouldn’t work?
<tr ng-repeat="record in records |filter:paginate|filter:{selectedCol:searchText}">Hi Drew,
Create an object by hand and use that.
add this to your select ng-change="filterOn={};filterOn[selectedCol]= searchText}"
and change the filter to use the filterOn object.
Regards
Sander
ng-change='filterOn={};filterOn[selectedCol]= searchText}'" should my ng-change call the function simply like " ng-change=filterOn()" or should it be ng-change="filterOn={};filterOn{[selectedCol]= searchText}". To be sure I'm understanding this correctly, the filtering happens when the function is executed returning the array of filtered records, right?...I will create and post the function that I'm thinking of. I appreciate your reply.
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/-MSRsjpygnM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.