Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Custom Table Data for table component cq5.5

Avatar

Former Community Member

Hello, 

I have a table component I have made that I want to include code at the beginning, but also be editable. For table data I have the following code 

<button onclick="cecontrol('row') ">–/+</buton>

<table border=" 0" cellspacing="0" cellpadding="1" width="100%" id="row">

I can put that in, and it works until it is edited. Once it is edited the first line is deleted and the id="row" is deleted. Is there a way to code it so that is always included in that component? 

1 Accepted Solution

Avatar

Correct answer by
Level 8

A simple hack would be to extend the table component, add your button in the JSP, and then parse the HTML from the text property and add your id value to the table tag. It's a hack but it would work. 

The complicated version would be to look at overriding the Ext JS Table Plugin for the Rich Text Editor widget and change its behavior so it either ignores your code, or adds it in automatically for you. I don't have examples of that for you, but you can take a look at http://dev.day.com/docs/en/cq/current/developing/widgets.html#par_title_3 for information on rich text plugins generally. 

View solution in original post

3 Replies

Avatar

Correct answer by
Level 8

A simple hack would be to extend the table component, add your button in the JSP, and then parse the HTML from the text property and add your id value to the table tag. It's a hack but it would work. 

The complicated version would be to look at overriding the Ext JS Table Plugin for the Rich Text Editor widget and change its behavior so it either ignores your code, or adds it in automatically for you. I don't have examples of that for you, but you can take a look at http://dev.day.com/docs/en/cq/current/developing/widgets.html#par_title_3 for information on rich text plugins generally. 

Avatar

Former Community Member

Thanks for your quick response, 

The problem with the first solution is that anytime the table is edited, it generates the default table border, cellspacing, cellpadding line of code and ignores the id="row" because of this. The button does stay, but it no longer functions. 

Avatar

Level 8

That's why you have to parse the text in the JSP when the component renders - you don't edit the row attribute in the content, you parse the content and add everytime your JSP renders - that's how you get around the behavior of the widget.