Primeng: Columns Maintain Order on Toggle

Created on 5 Oct 2018  路  2Comments  路  Source: primefaces/primeng

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
Please demonstrate your case at stackblitz by using the issue template below. Issues without a test case have much less possibility to be reviewed in detail and assisted.

This can be seen on the current coltoggle implementation on the site.

https://www.primefaces.org/primeng/#/table/coltoggle

Current behavior

When using a toggle, the columns will not maintain their order if you add the column back to the turbo table. It is instead added to the farthest right side of the columns.

Expected behavior

When a column is toggled, it should return to the same spot as its initial position in the turbo table.

Minimal reproduction of the problem with instructions
Go here: https://www.primefaces.org/primeng/#/table/coltoggle
Hit the checkbox of one of the columns
Hit the checkbox of the same column
You will see that it is added to the farthest right side of the grid

What is the motivation / use case for changing the behavior?
When using the turbo table, it can be confusing when you expect a column to be in the same place, but it ends up going to the end of the grid.

  • Angular version: 6

  • PrimeNG version: 6.1.3

  • Browser: [Chrome]

  • Language: [all]

Any help addressing this would be greatly appreciated!

Most helpful comment

First of all there is no column toggler component, the demo just uses multiselect to implement column toggler sample. MultiSelect always adds new items to the end so this is expected, on your side you can implement it with an order by comparing the value with the options list.

The PrimeNG team should put an example of this implementation in the column toggle demo page

All 2 comments

First of all there is no column toggler component, the demo just uses multiselect to implement column toggler sample. MultiSelect always adds new items to the end so this is expected, on your side you can implement it with an order by comparing the value with the options list.

First of all there is no column toggler component, the demo just uses multiselect to implement column toggler sample. MultiSelect always adds new items to the end so this is expected, on your side you can implement it with an order by comparing the value with the options list.

The PrimeNG team should put an example of this implementation in the column toggle demo page

Was this page helpful?
0 / 5 - 0 ratings