3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>qooxdoo » Demo</title>
5 <link type="text/css" rel="stylesheet" href="../../resource/css/layout.css"/>
7 <link type="text/css" rel="stylesheet" href="../../resource/css/layout_ie.css"/>
9 <script type="text/javascript" src="../../script/qx.js"></script>
12 <script type="text/javascript" src="../../script/layout.js"></script>
14 <div id="demoDescription">
15 <p>Test table with fixed column widths: 100, 50, 10, 30 and 20 pixel.</p>
18 <textarea id="info" style="position:absolute; top:48px; left:20px; width:600px;height:50px;border:1px solid black"></textarea>
19 <div id="view" style="position:absolute;top:148px;left:20px;width:400px;height:500px;border:1px solid black"></div>
20 <div id="scroller" style="position: absolute; top:148px; left:420px;height:500px;width:24px;border:1px solid black;overflow:scroll"><div id="scrollerContent" style="width:1px;height:5000px"></div></div>
23 <script type="text/javascript">
24 qx.core.Init.getInstance().defineMain(function()
28 var tableHeight = 512;
30 var entryCount = 1000;
33 var rowCount = Math.floor(tableHeight / rowHeight);
35 var view = document.getElementById("view");
36 var info = document.getElementById("info");
37 var scroller = document.getElementById("scroller");
38 var scrollerContent = document.getElementById("scrollerContent");
42 view.style.height = scroller.style.height = tableHeight + "px";
43 scrollerContent.style.height = Math.round(entryCount / rowCount * tableHeight) + "px";
50 for (var i=0; i<1000; i++) {
51 data.push({ col1 : "hello" + i, col2 : "world" + i, col3 : "foo" + i, col4 : "bar" + i, col5 : "baz" + i });
56 var undef = "undefined";
60 table_start : '<table cellspacing="0" cellpadding="0" style="table-layout:fixed;width:210px"><colgroup><col width="100"/><col width="50"/><col width="10"/><col width="30"/><col width="20"/></colgroup><tbody>',
61 table_end : "</tbody></table>",
64 tr_start_open : "<tr ",
68 td_start : '<td style="overflow:hidden;height:15px;border-right:1px solid red;border-bottom:1px solid red;padding-left:2px;padding-right:2px">',
72 function arrayAppend(arr, a) {
73 Array.prototype.push.apply(arr, a);
76 function getCellHtml(cdata)
78 var html = [ HTML.td_start, cdata, HTML.td_end ];
83 function getRowHtml(rdata, nr)
85 if (typeof cache[nr] != undef) {
90 html.push(HTML.tr_start_open);
94 html.push("style='background-color:#fff'");
97 html.push(HTML.tr_start_close);
99 for (var row in rdata) {
100 arrayAppend(html, getCellHtml(rdata[row]));
103 html.push(HTML.tr_stop);
110 function buildTableHtml(start, len)
112 var ttstart = (new Date).valueOf();
116 html.push(HTML.table_start);
118 for (var i=start, s=start+len; i<s; i++) {
119 arrayAppend(html, getRowHtml(data[i], i));
122 html.push(HTML.table_end);
123 view.innerHTML = html.join("");
127 var ttend = (new Date).valueOf();
128 info.value = "Update: " + updateCount + "\nRows: " + start + " - " + (start+len) + "\n" + (ttend-ttstart) + "ms\n";
131 function doscroll() {
132 buildTableHtml(Math.floor(scroller.scrollTop/rowHeight), rowCount);
135 qx.dom.DomEventRegistration.addEventListener(scroller, "scroll", doscroll);