0

I have seen other topics on this same scenario but none of them have been able to help me fix this issue.

I using ng-table within an AngularJS application. I am able to display the data and the pagination works fine but column filtering and sorting does not work. I am able to get the filters to appear but they do not do anything.

This is what my HTML table looks like:

<table ng-table="tableParams" show-filter="true" class="paginationclass" style="width: 100%" border="1">

    <tr ng-repeat="counter in $data">
        <td data-title="'Survey Header ID'" filter="{ surveyHeader_id: 'text'}" sortable="'surveyHeader_id'">{{counter.header.surveyHeader_id}}</td>
        <td data-title="'Survey ID'" filter="{ survey_id: 'text'}" sortable="'survey_id'">{{counter.header.survey_id}}</td>
        <td data-title="'VOC Channel'" filter="{ vocChannel_name: 'select'}" filter-data="DD.vocchannels_dd" sortable="'vocChannel_name'">{{counter.header.vocChannel_name}}</td>
    </tr>

</table>

Here is ths code inside my JS controller:

    var tableParams = {
        count: 15
    };
    var tableSettings = {

    };

$http.jsonp(URL)
    .success(function (data) {
        $scope.surData = data;

        tableSettings.data = $scope.surData;
        $scope.tableParams = new NgTableParams(tableParams, tableSettings);
    }

What am I doing wrong?

1
  • Can you add a data sample Commented May 12, 2017 at 19:37

1 Answer 1

1

Ng-table sorting wont work on nested objects. Try to build your data without the header to make it looks like : counter.surveyHeader_id instead of counter.header.surveyHeader_id

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.