Hi,
How can I sanitize HTML strings value in Igx-column?
For example:
From:
To:
Thank you!
Regards,Afif
Hello,
I have been looking into your question and what I could suggest is using the provided igxCell directive and re-template in order to display the cells' values per your requirement.
As it is suggested in this topic in the Angular documentation in order to display an HTML in the required format you could set the parameter which holds the HTML string to the innerHTML attribute of an element. I have prepared a small sample that demonstrates this approach and it could be found here.
However, please keep in mind that sanitizing HTML value should be handled entirely on the application level and since it is not related to our components it could be considered beyond the scope of Infragistics support.
Let me know if I may be of any further assistance.
Sincerely,Teodosia HristodorovaSoftware Developer
Hi, thank you for your comprehensive answers. I was able to produce the output using the igxCell directive.
However, I've one more related question to this: how would I be able to achieve the same result in the Excel export?
Thank you.
Best regards
Afif
After an investigation, I believe that the best suggestion is subscribing to the exporter rowExporting event and changing the value of the exported data based on your requirement.
So, in order to modify the HTML string, a possible approach would be using regex, which would translate the HTML to understandable for Excel value, however, as previously mentioned this is beyond the scope of Infragistics support.
Here could be found the modified sample that demonstrates a simple approach for achieving similar behavior. Let me know if I may be of any further assistance.
I am glad that you find my suggestion helpful.
Thank you for using Infragistics components.
Regards,Teodosia HristodorovaSoftware Developer
Noted. Thank you once again for your great effort and support.
Best RegardsAfif