pnp / List-Formatting

List Formatting Samples for use in SharePoint and Microsoft Lists
https://pnp.github.io/List-Formatting/
MIT License
1.7k stars 822 forks source link

updated multi-lookup-projected-field to use split and forEach #697

Closed timberrr closed 10 months ago

timberrr commented 11 months ago
Q A
Bug fix? no
New sample? no

What's in this Pull Request?

Updated the multi-lookup-projected-field example to use the split operator on the string value of the projected field and then forEach to handle the formatting. Greatly simplifies the process and offers more flexibility now that there's a split function available that slots nicely into forEach.

Having discovered the (new?) split operator, I've found it works quite well with the projected fields of a multi-choice lookup column. It seems to resolve the highlighted limitations with the previous method, specifically the complexity and need to manually add extra conditions for different counts of items.

Hopefully this contribution is all done correctly - I haven't contributed much before so apologies if anything isn't right, but when I spotted this I wanted to try and give back to this excellent resource!

tecchan1107 commented 10 months ago

Sorry for the delay! Thanks for the fix🤩!!!

As you mentioned, the split operator became available around August of last year, and until then we had to write it the way it was before the change. Once again, thank you for using the split operator and fixing the code to make it very simple and easy to understand!

tecchan1107 commented 10 months ago

If you are interested, please register for the following program. When you register, you will get a digital badge! M365 Platform & Power Platform Community Recognition Program

※Even if you register, it will not be distributed immediately. It will take some time before it is distributed.