0

I have two tables that I want to filter by either using an individual select dropdown in the table row or by selecting multiple checkboxes and bulk updating the scope.

A user should be able to check the records, select the top dropdown status, and then the scope gets updated. If the status is greater than or equal to 1 it goes in one table, if less then it goes in the other table.

Fiddle http://jsfiddle.net/TheFiddler/hxz06sd7/

How can I use the checkboxes to update the checked values based upon selected value?

The select

 <select ng-options="item.value as item.displayName for item in StatusDropDown" ng-model="person.status" ng-change="updateSelected()"></select>

updatedSelected should take the checked rows and filter:

$scope.updateSelected = function(statusarg){
            //how to set status for selected and update tables

}
PSL
  • 123,204
  • 21
  • 253
  • 243
User970008
  • 1,135
  • 3
  • 20
  • 49
  • Shouldn't have put the fiddle in the comment. :) Now that you got most part of your original question figured. Your question originally was too broad. I had placed ng-model in those checkboxes, On click of save just filter persons to get the checked ones. – PSL Jan 15 '15 at 04:27

1 Answers1

0

Associate ng-model (person.selected) to the checkboxes and on-change, filter them out based on the selected property, and apply the value to them.

$scope.updateSelected = function (statusarg) {
    //how to set status for selected and update tables
    angular.forEach($scope.people, function(person){
        person.selected && (person.status = statusarg);
    });
}

Fiddle

Earlier issues with your code was that: You should not use track by with select as syntax they are not meant to work together. You would rarely need to use track by with ng-options. Read this for more details.

PSL
  • 123,204
  • 21
  • 253
  • 243