I am trying to have a select filter in ngtable. I followed this example but looks like if the select item has a space (eg: Not Installed
or Not Running
- Need exact filter match
ng-table
doesn't actually apply the filters the data - it's only responsible for collecting the filter values from the user.
In your getData
function you've configured ng-table with, you are using the angular $filter service to apply the filter. It's this service that is responsible for doing the actual filtering. Therefore if you want an exact match behaviour you will need to use something other than $filter.
- ...extra blank entry which is removed once user selects and clicks the select filter again
UPDATE: I have edited my previous answer.
I've fixed this particular issue with ng-table. Here's a conversation about the problem: https://github.com/esvit/ng-table/pull/654#issuecomment-127095189
The commit for the fix: 1ee441
- Auto width of ngtable w.r.t it's data.
Column widths for the rendered html table are controlled using css. ng-table
does not add anything specific. You should create your own style rules to change the widths. Tip: you can also use colgroup
in the html markup and assign a specific width to each <col>
tag
if Okonomy is saying that you could just do the following
filter="{ 'name': 'select' : true }"
<td data-title="'Status'" class="text-center" header-class="text-center" width="40px" filter="{ 'name': 'select' : true }" sortable="'status'" filter-data="filterAgentStatus($column)"><img ng-src="{{ item.status }}" /></td>
i did not find this to be true. You would need to go into the .js file controlling that page and do something more like the below.
var newStudies = $filter('filter')(controller.TableData, params.filter(), true);
But this forces all filters in the table to exact match (and therefore your table would be empty). So you have to make a custom filter. There are examples of custom attributes here in the below link. Not great examples, but it is an example: custom filter example for ng-table
<td data-title="'Status'" class="text-center" header-class="text-center" width="40px" filter="{ 'name': 'select-multiple' }" sortable="'status'" filter-data="filterAgentStatus($column)"><img ng-src="{{ item.status }}" /></td>
Note: I think you better pass item to filterAgentStatus, instead of $column: filterAgentStatus(item).