angularjssortingcheckboxng-filter

Filtering is not working properly for Name and Description selection?


I am trying to do one task of angularjs grid from google searching which is having sorting, pagination and filtering. Sorting and Pagination are working fine, but filtering is not working properly.

I would like to filter the data based on my Name and Description checkbox selection. If we observe clearly, for example: if I select any name(either name1 or name2 or name3 checkbox) of Name column, then it's relevant data should display. But what I am getting is: it is displaying all the data which belongs to Name column based on my checkbox selection criteria(that's fine), but also displaying the data wherever name1 is aapplicable/available(from Description column too), and similarly it is working the same for Description checkbox selection criteria too.

But it should not display like that, it should display only the data based on my either Name or Description checkbox selection criteria from the respective Name/Description column only, but not from both the columns that wherever it is aapplicable/available), that is: if I select any filter name(either name1 or name2 or name3 checkbox) of Select Name dropdown, then it's relevant data should display, means I should see only "name1" in Name column(but it is giving with name3 also), similarly for Description checkboxes.

Created fiddle. Please help me that what and where I am doing wrong ? Thanks in advance.


Solution

  • I'm not sure I understood your question quite right, but you could use your own filter function.

    I've slightly modified your fiddle, here. Basically I've added a new $scope.filterItems function and modified the markup accordingly. It's just an example, you need to modify it for your needs.

    Is this what you were after?