Override [column] property with ngx-datatable-column
See original GitHub issueI’m submitting a … (check one with “x”)
[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter
Current behavior
It is impossible to use both [columns]=""
and ngx-datatable-column
templates at the same time. I have a standard list of default columns for each my models, which I use to populate [columns]
, however sometimes I want to display the data as something other than the value (for example, displaying a date in a different locale). In order to do this, I have to redefine all my columns using ngx-datatable-column
, as if you use both, it will only use columns defined using inline templates.
Expected behavior
I would like to be able to provide an object defining columns, and additionally override how any of these columns are displayed using ngx-datatable-column
. What should be displayed is all columns provided by the object, and where any columns are defined both in the object and as an inline template, the inline template is used as an override.
Reproduction of the problem
What is the motivation / use case for changing the behavior? Many users will need to change how data is displayed in the table, and keeping all your columns as templates is inefficient.
Please tell us about your environment: N/A
-
Table version: 10.2.1
-
Angular version: 4.3.6
-
Browser: All
-
Language: TS
Issue Analytics
- State:
- Created 6 years ago
- Reactions:12
- Comments:5
Top GitHub Comments
Just started with ngx-datatable and I’m suprised there is no such a feature… whole point on column orders are pointless 😕
I’ve created this modification in my local version, which allows me to define as an object, template, or both. Templates will always override the object, and keep the same order. Any templates which aren’t included in the object are appended.
src/components/datatable.component.ts:545
If this is of interest as a feature, I can submit a pull request.