Expand my Community achievements bar.

SOLVED

table RichText in multifield

Avatar

Former Community Member

I have added a dialog component , in which there are two tabs, tab_1 with xtype text field and tab_2 with xtype custom multifield, this multifield contains three field -> Textfield, Textarea and for third field I want to create a table for which I am using CQ.form.RichText, help me to add table plugin in it. Below is the Js code :

 this.tableRichText = new CQ.form.RichText({ //used CQ.form.TableEdit2 also, but values given to table does not persist and is not able to render table values in jsp

        //fieldLabel: "Table:",
        //fieldDescription: "Please provide the table values",
        defaultValue: "<table cellspacing='0' border='1' width='500'><thead><tr><td>Column 1 Heading</td><td>Column 2 Heading</td></tr><tr></thead><tbody><tr><td> </td><td> </td></tr><tr><td> </td><td> </td></tr></tbody></table>",
        name: "./tableRichText",
        width: 525,
       // plugins: CQ.form.rte.plugins.TablePlugin,
        listeners: {
            change: {
                scope: this,
                fn: this.updateHidden
            }
        }
    });

In jsp I amrendering the values like :

String[] stemSentence = properties.get("stem-sentence",new String[0]);
String stemSentenceHeadingText = null;
String stemSentenceParagraphText = null;
String tableRichText = null;

JSONObject jsonObject = null;

for(String stmSentence : stemSentence){

                    jsonObject = new JSONObject(stmSentence);
                       stemSentenceHeadingText = jsonObject.getString("stemSentenceHeadingText");
                    stemSentenceParagraphText = jsonObject.getString("stemSentenceParagraphText");
                    tableRichText = jsonObject.getString("tableRichText");

<% =tableRichText %>

Please help how do I achieve a table component in multifield ?

1 Accepted Solution

Avatar

Correct answer by
Level 10
1 Reply

Avatar

Correct answer by
Level 10