primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Identifier property for TabPanel to enable tab based routing

Open nillion opened this issue 9 years ago • 5 comments

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

[ ] bug report => Search github for a similar issue or PR before submitting
[x] 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

Current behavior TabView component exposes 'activeIndex' to programmatically control the currently selected tab.

Expected behavior An identifier property for TabPanel component to control the selected tab based on the identifier rather than the index of the tab as the index of the tabs can change in various scenarios.

What is the motivation / use case for changing the behavior? The identifier would enable URL fragment based navigation for tabs. Currently routing for tabs cannot be done without hacks.

Another use case could be this - https://forum.primefaces.org/viewtopic.php?f=35&t=52239&p=159502&hilit=tabpanel#p159502

  • Angular version: 4.3.6

  • PrimeNG version: 4.2.1

  • Language: [TypeScript 2.3.0]

nillion avatar Sep 26 '17 14:09 nillion

This functionality will help to deal with applications where users have the ability to create or delete tabs on demand.

The activeIndex is not very helpful and also we cannot rely on tab Names, in a localized application.

ajaydev12 avatar Sep 26 '17 17:09 ajaydev12

+1

If, say, certain tabs are in *ngIfs, there's no obvious way to know the index of a particular tab.

adama357 avatar Mar 06 '18 17:03 adama357

one solution to overcome the problem is to rely on a directive that extends the tabview with converting the active index to a query string name, keeping into account the hidden panels along the way code https://stackblitz.com/edit/primeng-issues-tabview-name sample https://primeng-issues-tabview-name.stackblitz.io/?tab=three

dandohotaru avatar Oct 29 '19 14:10 dandohotaru

This would be nice, we wouldn't have to make hacks.

filip12345678910 avatar Jun 19 '20 10:06 filip12345678910

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you reopen the issue so we can include it in our roadmap? Please don't forget to add your feedback as a comment after reopening the issue. These will be taken into account by us and will contribute to the development of this feature. Thanks a lot for your understanding!

Best Regards,

mertsincan avatar Nov 09 '22 14:11 mertsincan