Home
Analytics
insert html text inside table cell
suresh@anumolu
<p>Hi, I am planning to insert an another cell inside my table to embed html text in it. So each row will contain different html text based on other columns.</p>
<p>I am wondering whether you can help on how to achieve this task. I have managed to insert a text element inside the cell but i could not see any text value in it. Can you please give sample snippet. Thanks for your help inadvance. </p>
<p> </p>
<p>Thanks</p>
<p>Suresh</p>
Find more posts tagged with
Comments
pricher
<p>Hi,</p>
<p> </p>
<p>In the Edit Text Item dialog, make sure you choose HTML in the drop-down at the top, then choose Dynamic Text from the drop down above the editor area. You can then click on <VALUE-OF> to insert columns defined in the data bindings of your table:</p>
<p> </p>
<p>
suresh@anumolu
<p>Thanks Pierre, I am designing the report using scripted dataset. It would be helpful if you can send me instruction with scripted API. </p>
<p> </p>
<div>Right now i have something like below but it doesnt display any text ..any help would be appreciated.</div>
<div> txt = elementFactory.newTextItem("DrillDown"); //Create new label</div>
<div> txt.setContentType("html");</div>
<div> content = "<![CDATA[<a href=\"javascript:parent.callShowDetailsJS('ReportDate_BKT:20150701');\" ><span> </span>Show Details for ReportDate:20150701</a>]]>";</div>
<div> txt.setContent(content);</div>
<div> //txt.setExpressionProperty("dataSetRow[\"SeriesID\"]");</div>
<div> tcell.getContent().add(txt); </div>
<div> </div>
<div>Thanks for your help.</div>
pricher
<p>I am confused. You say you are designing using a scripted data set, but all I am seeing is Java code using the BIRT Design API. Is the snippet of code part of a Java class? If so, please post the Java class.</p>
<p> </p>
<p>Thanks,</p>
<p> </p>
<p>P.</p>
suresh@anumolu
<p>Pierre Richer, </p>
<p> </p>
<p>I am creating scripted DATASET using BIRT design API. and the code i posted earlier was written in beforeFactory method. I am just trying to create an additional filed which should contain above html text init. this not a java class, all the code written in beforeFactory event method. </p>
<p>Please let me know if you have any questions. </p>
<p> </p>
<p>Thanks</p>
<p>Suresh</p>
pricher
<p>Hi Suresh,</p>
<p> </p>
<p>Can you send your report design? Is this Open Source or Commercial BIRT?</p>
<p>The snippet of code has nothing to do with creating a Scripted Data Set; it adds a text item to an existing table.</p>
<p>Maybe you could describe what you are attempting to do. At this point, you do not seem on the right track and I'd like to shed some light!</p>
<p> </p>
<p>P.</p>
suresh@anumolu
<p>Pierre Richer, </p>
<p> </p>
<p>We have commercial license.</p>
<p>Yes, you are right. the snippet i posted has nothing to do with creating a scripted dataset. i have rest of the code which creates the scripted dataset and table based on our propriertary database. So i am not in a position to share the rest of the code.</p>
<p> </p>
<p>I just need some help on how to add the dynamic text fields using java script to existent table. </p>
<p>Also i have tried to create the html using the instructions you had sent earlier, the xml source has the following elements. Please let me know how to create the following snippet using the java script API.</p>
<p> </p>
<div>
<div> <cell id="63"></div>
<div> <text id="67"></div>
<div> <property name="contentType">html</property></div>
<div> <text-property name="content"><![CDATA[<VALUE-OF>row["CUSTOMERNAME"]</VALUE-OF>]]></text-property></div>
<div> </text></div>
<div> </cell></div>
</div>
<p> </p>
<p>Please let me know if you have any questions.</p>
pricher
<p>Hi,</p>
<p> </p>
<p>Try removing the CDATA from the string you pass to the text item's setContent method, eg:</p>
<pre class="_prettyXprint _lang-">
content = "<a href=\"javascript:parent.callShowDetailsJS('ReportDate_BKT:20150701');\" > Show Details for ReportDate:20150701</a>";
</pre>
<p>Let me know if it works!</p>
<p> </p>
<p>P.</p>
suresh@anumolu
<p>Pierre Richer, </p>
<p> </p>
<p>Thanks for the prompt response. That works fine but the value is constant for the entire table. Can you please tell me how can i insert other cell value </p>
<p> </p>
<p>for eg is it possible to append row[\"col\"] inside of that content element? thanks again for your help on this.</p>
pricher
<p>You can add values from data bindings using the <value-of> tag, such as:</p>
<pre class="_prettyXprint _lang-">
content = "<a href=\"javascript:parent.callShowDetailsJS('<VALUE-OF>row[\"COUNTRY\"]</VALUE-OF>');\" ><VALUE-OF>row[\"COUNTRY\"]</VALUE-OF></a>";
</pre>
suresh@anumolu
<p>Thats works Perfect. Thanks for your help and your prompt response. Much appreciated.</p>