Primeng: MultiSelect label parameter

Created on 18 Apr 2017  路  3Comments  路  Source: primefaces/primeng

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

Expected behavior
Add a parameter for the MultiSelect to set a constant label instead of the selected data.

What is the motivation / use case for changing the behavior?
If the selected data are too long, the MultiSelect becomes really awful and barely readable...

enhancement

Most helpful comment

3 new attribute added to multiselect component for this issue. After 4.0.0-Final multiselect component will have displaySelectedLabel attribute for deciding to show the defaultLabel or with new maxItems attribute.maxItems attribute have a default value of 3. After 3 selections container displays a message like "4 items selected". And you can specify your own message for this with new selectedItemsLabel attribute which is by default have a value of "{0} items selected". @Helayxa @codechamploo

All 3 comments

This would be a useful one. I would suggest taking it a step further and add a "max items before cut off" value. For example, if n items are selected, the label parameter will take effect so we can see something like "5 Selected", "6 Selected", if the threshold is set at 4 items.

3 new attribute added to multiselect component for this issue. After 4.0.0-Final multiselect component will have displaySelectedLabel attribute for deciding to show the defaultLabel or with new maxItems attribute.maxItems attribute have a default value of 3. After 3 selections container displays a message like "4 items selected". And you can specify your own message for this with new selectedItemsLabel attribute which is by default have a value of "{0} items selected". @Helayxa @codechamploo

@Mrtcndkn @cagataycivici
Is it possible to add this to latest 2.x version too? I have strict limitation on Angular version and cannot update it to 4.x, which implies PrimeNG 2.x.

Any help is appreciated. Thanks

Was this page helpful?
0 / 5 - 0 ratings