ngx-datatable: Sorting not working when template let-column="column" used

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior

When <template let-column="column"> tag is added to an expressive template, sorting function for that column doesn’t work.

Expected behavior

Sorting should work.

Reproduction of the problem

In your own example in the documentation you can see this behaviour https://plnkr.co/edit/iH1e7cIAdX5Ds4jY7WYc?p=preview

<template let-column="column"> Hi + {{column.name}} </template>

What is the motivation / use case for changing the behavior?

Sort by column with a customized title

Please tell us about your environment:

Window 10

  • Table version: 0.7.x

    0.11.2

  • Angular version: 2.0.x

    2.1.1

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

    all

  • Language: [all | TypeScript X.X | ES6/7 | ES5] TS 2.0.3

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 15 (4 by maintainers)

Most upvoted comments

The above works for let-value, but for let-column It doesn’t. Even with prop and name. This resolved it though

https://github.com/swimlane/ngx-datatable/issues/681#issuecomment-297386597

Thanks ! Using prop and name worked for me

<datatable-column name="Foo Bar" prop="fooBar"> <template let-value="value"> {{value}} </template> </datatable-column>

You need to use prop vs name.

@amcdnl I think you misunderstood me. I was talking about being able to click on the column header and change the sort direction. This function does not work if I use a custom template for the column header. Is there a possibility to be able to change column sorting when using a custom template?