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 <style type="text/css">*{ font-size: 10px; font-family: Verdana }</style>
16 <div id="demoDescription">
20 <textarea id="info" style="position:absolute; top:48px; left:20px; width:600px;height:50px;border:1px solid black"></textarea>
21 <div id="view" style="position:absolute;top:148px;left:20px;width:400px;height:500px;border:1px solid black"></div>
22 <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>
25 <script type="text/javascript">
26 qx.core.Init.getInstance().defineMain(function()
30 var tableHeight = 512;
32 var entryCount = 1000;
35 var rowCount = Math.floor(tableHeight / rowHeight);
37 var view = document.getElementById("view");
38 var info = document.getElementById("info");
39 var scroller = document.getElementById("scroller");
40 var scrollerContent = document.getElementById("scrollerContent");
44 view.style.height = scroller.style.height = tableHeight + "px";
45 scrollerContent.style.height = Math.round(entryCount / rowCount * tableHeight) + "px";
52 for (var i=0; i<1000; i++) {
53 data.push({ col1 : "hello" + i, col2 : "world" + i, col3 : "foo" + i, col4 : "bar" + i, col5 : "baz" + i });
58 var undef = "undefined";
62 table_start : "<table><tbody>",
63 table_end : "</tbody></table>",
66 tr_start_open : "<tr ",
74 function arrayAppend(arr, a) {
75 Array.prototype.push.apply(arr, a);
78 function getCellHtml(cdata)
80 var html = [ HTML.td_start, cdata, HTML.td_end ];
85 function getRowHtml(rdata, nr)
87 if (typeof cache[nr] != undef) {
92 html.push(HTML.tr_start_open);
96 html.push("style='background-color:#fff'");
99 html.push(HTML.tr_start_close);
101 for (var row in rdata) {
102 arrayAppend(html, getCellHtml(rdata[row]));
105 html.push(HTML.tr_stop);
112 function buildTableHtml(start, len)
114 var ttstart = (new Date).valueOf();
118 html.push(HTML.table_start);
120 for (var i=start, s=start+len; i<s; i++) {
121 arrayAppend(html, getRowHtml(data[i], i));
124 html.push(HTML.table_end);
125 view.innerHTML = html.join("");
129 var ttend = (new Date).valueOf();
130 info.value = "Update: " + updateCount + "\nRows: " + start + " - " + (start+len) + "\n" + (ttend-ttstart) + "ms\n";
133 function doscroll() {
134 buildTableHtml(Math.floor(scroller.scrollTop/rowHeight), rowCount);
137 qx.dom.EventRegistration.addEventListener(scroller, "scroll", doscroll);