@Override protected void postHead(Page.HTML<_> html) { html. style().$type("text/css"). _("#cs { padding: 0.5em 0 1em 0; margin-bottom: 1em; position: relative }", "#cs ul { list-style: none }", "#cs a { font-weight: normal; margin: 2px; position: relative }", "#cs a span { font-weight: normal; font-size: 80% }", "#cs-wrapper .ui-widget-header { padding: 0.2em 0.5em }", ".qstats { font-weight: normal; font-size: 80%; position: absolute }", ".qlegend { font-weight: normal; padding: 0 1em; margin: 1em }", "table.info tr th {width: 50%}")._(). // to center info table script("/static/jt/jquery.jstree.js"). script().$type("text/javascript"). _("$(function() {", " $('#cs a span').addClass('ui-corner-all').css('position', 'absolute');", " $('#cs').bind('loaded.jstree', function (e, data) {", " data.inst.open_node('#pq', true);", " }).", " jstree({", " core: { animation: 188, html_titles: true },", " plugins: ['themeroller', 'html_data', 'ui'],", " themeroller: { item_open: 'ui-icon-minus',", " item_clsd: 'ui-icon-plus', item_leaf: 'ui-icon-gear'", " }", " });", " $('#cs').bind('select_node.jstree', function(e, data) {", " var q = $('.q', data.rslt.obj).first().text();", " if (q == 'root') q = '';", " else q = '^' + q.substr(q.lastIndexOf('.') + 1) + '$';", " $('#apps').dataTable().fnFilter(q, 3, true);", " });", " $('#cs').show();", "});")._(); }
@Override public void render(Page.HTML<_> html) { set(DATATABLES_ID, "t1 t2 t3 t4"); set(initID(DATATABLES, "t1"), tableInit().append("}").toString()); set(initID(DATATABLES, "t2"), join("{bJQueryUI:true, sDom:'t',", "aoColumns:[null, {bSortable:false, bSearchable:false}]}")); set(initID(DATATABLES, "t3"), "{bJQueryUI:true, sDom:'t'}"); set(initID(DATATABLES, "t4"), "{bJQueryUI:true, sDom:'t'}"); html. title("Test DataTables"). link("/static/yarn.css"). _(JQueryUI.class). style(".wrapper { padding: 1em }", ".wrapper h2 { margin: 0.5em 0 }", ".dataTables_wrapper { min-height: 1em }"). div(".wrapper"). h2("Default table init"). table("#t1"). thead(). tr().th("Column1").th("Column2")._()._(). tbody(). tr().td("c1r1").td("c2r1")._(). tr().td("c1r2").td("c2r2")._()._()._(). h2("Nested tables"). div(_INFO_WRAP). table("#t2"). thead(). tr().th(_TH, "Column1").th(_TH, "Column2")._()._(). tbody(). tr().td("r1"). // th wouldn't work as of dt 1.7.5 td().$class(C_TABLE). table("#t3"). thead(). tr().th("SubColumn1").th("SubColumn2")._()._(). tbody(). tr().td("subc1r1").td("subc2r1")._(). tr().td("subc1r2").td("subc2r2")._()._()._()._()._(). tr().td("r2"). // ditto td().$class(C_TABLE). table("#t4"). thead(). tr().th("SubColumn1").th("SubColumn2")._()._(). tbody(). tr().td("subc1r1").td("subc2r1")._(). tr().td("subc1r2").td("subc2r2")._(). _()._()._()._()._()._()._()._()._(); }