Ng-table: Select filter is showing all values as undefined

Created on 1 Aug 2016  ·  6Comments  ·  Source: esvit/ng-table

My html

<table ng-show="!loading" show-filter="true" class="ebTable eftf ebTable_striped" ng-table="tableParams" template-pagination="custom-pager"> <tr ng-repeat="probe in $data"> <td data-title="'Host'" sortable="'host'" filter="{host: 'select'}" filter-data="fetchHosts($column)">{{probe.host}}</td>

My controller

$scope.fetchHosts = function ($column) { if($column.title() === "Host") { return [{host: "192.168.1.34"}, {host: "192.168.1.36"}]; } };

The documentation for the select filter only says that the fetchData function must return an array or a promise that returns an array etc. Despite that it fails, something is missing from the documentation i think.

Most helpful comment

Ok, i have got it working. The values are being shown in the dropdown now(not undefined anymore). The doc did not specify that the id and title attribute are necessary. I wish the document was more explicit. Please correct me if i am wrong in using id and title.

All 6 comments

Ok, i have got it working. The values are being shown in the dropdown now(not undefined anymore). The doc did not specify that the id and title attribute are necessary. I wish the document was more explicit. Please correct me if i am wrong in using id and title.

@raul1991 Can you please close this since you have solved already?

Thank you. The reason why I barely use ngTable, it's because of documentation.

This should be reopened until the documentation is fixed. Searching Google for an explanation of the "undefined" behaviour and being pointed to a closed issue does not really "solve" the problem, you know.

I agree. Just in case you could not get it done. Make sure to pass 'id' and title for a drop-down.

Can't you just fix the docs yourself and submit a pull request....

Was this page helpful?
0 / 5 - 0 ratings

Related issues

batjko picture batjko  ·  3Comments

alienriquebm picture alienriquebm  ·  6Comments

Nagendra1402 picture Nagendra1402  ·  3Comments

esvit picture esvit  ·  37Comments

Ebolon picture Ebolon  ·  12Comments