I have been experimenting with angular.js as a way of handling sortable and searchable lists of data.
Used this RailsCast to get started http://railscasts.com/episodes/405-angularjs
And then went through the example of filters here http://docs.angularjs.org/api/ng.filter:filter
Was awestruck when I had something running in minutes sorting and filtering. I therefore appear to have an ideal approach to presenting tabular data that is sortable and searchable by filtering across every column...
Until I realised that the filter does not appear to work on json nested attrbutes addressed using '.' notation e.g. my clients all have an owner and I want to display their email address and sort and sift by this field - key parts of my code look like this.
<tbody ng-repeat="client in clients | orderBy:sort_by:reverse | filter:search">
<tr>
<td>{{name}}</td>
<td>{{owner.email}}</td>
<tr>
<input ng-model="search.name">
<input ng-model="search.owner.email">
The owner.email is rendered and can be sorted but it won't filter. I have a workaround of :only allowing one attribute per :include association and searching on the association e.g. search.owner filters on the owner's email because that's all I have allowed into the json. This feels like a hack. There must be properly elegant way of doing this. What is it?
As mentioned in the comments above, you'll probably have to use a custom filter. A custom filter can filter based on search.owner.email or whatever other criteria/input you want.