Mercurial > hg > STI-GWT
changeset 71:a610b45d0f90 trimmed_data
Allow HTML in all Cells
author | Sebastian Kruse <skruse@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 11 Jan 2013 09:41:16 +0100 |
parents | e6b72868e395 |
children | 4d3df00f5b98 |
files | src/econnect/wp3_3/client/widgets/table/DynamicStiTable.java war/scripts/sti/STICore.js |
diffstat | 2 files changed, 19 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/econnect/wp3_3/client/widgets/table/DynamicStiTable.java Thu Jan 10 13:21:12 2013 +0100 +++ b/src/econnect/wp3_3/client/widgets/table/DynamicStiTable.java Fri Jan 11 09:41:16 2013 +0100 @@ -325,10 +325,14 @@ for (int i = 0; i < descriptionDataColumns.length(); i++) { final String columnName = descriptionDataColumns.get(i); - TextColumn<DataObject> column = new TextColumn<DataObject>() { + SafeHtmlCell htmlCell = new SafeHtmlCell(); + + Column<DataObject, SafeHtml> column = new Column<DataObject, SafeHtml>(htmlCell) { @Override - public String getValue(DataObject object) { - return object.getDescriptionData(columnName); + public SafeHtml getValue(DataObject object) { + SafeHtmlBuilder sb = new SafeHtmlBuilder(); + sb.appendHtmlConstant(object.getDescriptionData(columnName)); + return sb.toSafeHtml(); } };
--- a/war/scripts/sti/STICore.js Thu Jan 10 13:21:12 2013 +0100 +++ b/war/scripts/sti/STICore.js Fri Jan 11 09:41:16 2013 +0100 @@ -380,7 +380,18 @@ lastHeader = $(this).text(); isHeader = false; } else { - var value = $(this).text(); + //var value = $(this).text(); + var value = ""; + + $(this).children().each( + function() { + value += (new XMLSerializer()).serializeToString(this); + } + ); + + if (value.length == 0) + value = $(this).text(); + if (descriptionData[lastHeader] != null) //append if a field occures more than once descriptionData[lastHeader] += "\n" + value;