@import act.util.DataTable, org.osgl.Lang, org.osgl.util.S @args DataTable table

@if(!table.isTransposed()) {
@for(table.heading()) { @(_.equals("_this_") ? "data" : _) }
}
@def boolean isUrl(Object v) { if (null == v) {return false;} if (!(v instanceof String) && !(v instanceof Appendable)) { return false; } String s = v.toString(); return s.startsWith("http://") || s.startsWith("https://"); } @def String addHtmlTableAccept(Object v) { if (null == v) return ""; String url = v.toString(); return url + (url.contains("?") ? "&" : "?") + "_accept=htmltable"; } @def String toString(Object v, boolean withPre) { if (null == v) return ""; if (!Lang.isSimpleType(v.getClass())) { String s = com.alibaba.fastjson.JSON.toJSONString(v, true); s = S.strip(s).of(S.DOUBLE_QUOTES); return withPre ? "

    " + s + "

" : s; } return v.toString(); } @def String toString(Object v) { return toString(v, true); } @for(Object row: table) {
@for(String label: table.heading()) { @{ Object v = table.val(row, label) } 50) { title="@toString(v, false)" } > @if(isUrl(v)) { @v } else if (null == v || "".equals(v.toString().trim())) { } else { @toString(v).raw() } }
}