question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom header not sorting column

See original GitHub issue

Hi, when I use this template https://github.com/esvit/ng-table/blob/master/src/ng-table/sorterRow.html as custom template (as external file without any modification , script id is testtableheader) , then ng-click event not fired for me. When I not use the template-header=“testtableheader” in my table then everything is ok, sorting works fine.

id="xxxModalContent.html

<div class="table-browser" ng-controller="xxxController" >

    <table ng-table="tableParams" show-filter="false" class="table"  template-header="testtableheader">
        <tr ng-repeat="datas in $data" ng-click="selectrow(datas)" class="{{['even', 'odd'][$index %2]}}">

            <td data-title="'Id'" sortable="'id'">{{datas.id}}</td>
            <td data-title="'Name'" sortable="'name'">{{datas.name}}</td>

        </tr>
    </table>
</div>

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
BenevidesLecontescommented, Feb 22, 2017

@christianacca I’m having the same issue with custom header, used your example and my template is rendered, but sort function is not working, already tried ng-click="$ctrl.sortBy($column, $event)", ng-click="sortBy($column, $event)" or

ng-controller="ngTableSorterRowController"  ng-click="$ctrl.sortBy($column, $event)"

in my th and none of this is working, am i missing something?

1reaction
romanlytvyncommented, Aug 24, 2015

The example is a bit outdated. The new header template uses ng-table-sorter-row directive. sortBy($column, event) is now defined inside ngTableSorterRowController Since we don’t have an ability to override sorterRow template, the easy fix would be to use this controller in header template, like:

<th ng-controller="ngTableSorterRowController" title="{{$column.headerTitle(this)}}"...
Read more comments on GitHub >

github_iconTop Results From Across the Web

Column sorting not working when using custom HeaderView
If I set the TableView obj my custom HeaderView , clicking on the header won't sort, even though my custom HeaderView re-implements nothing....
Read more >
How to Make Custom Sorting Headers in Tableau - phData
In this post, I'll be walking through how to create table headers in Tableau that allows your users to customize the sorting of...
Read more >
Frozen top row not recognized as header in custom sort
I want to custom sort my excel sheet alphabetically by my first 2 columns, "first name" and "last name". I have the first...
Read more >
Sorting not working on Custom Header Cell - Telerik
The sort doesnt work when I use a CustomHeaderCell for that particular column. Can you help me out with that please?
Read more >
Excel Sort by Column without Header (5 Methods) - ExcelDemy
Whenever you try to sort any data, excel will sort it by column if you do not instruct it to do otherwise using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found