Author: dmorozov
Date: 2007-06-26 13:54:39 -0400 (Tue, 26 Jun 2007)
New Revision: 1330
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx
Log:
little performance improvement
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-06-26
17:26:16 UTC (rev 1329)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-06-26
17:54:39 UTC (rev 1330)
@@ -157,7 +157,7 @@
defaultWidth += columns[j].width;
columns[j].object = new ClientUI.common.box.InlineBox(cell, null, true);
- var details = this._getCellElements(cell);
+ var details = this._getCellElements(j);
// separator
columns[j].sep = new ClientUI.common.box.InlineBox(details[0], null, true);
columns[j].sep.getElement().columnIndex = j;
@@ -207,7 +207,7 @@
defaultWidth += columns[j].width;
columns[j].object = new ClientUI.common.box.InlineBox(cell, null, true);
- var details = this._getCellElements(cell);
+ var details = this._getCellElements(j);
// separator
columns[j].sep = new ClientUI.common.box.InlineBox(details[0], null, true);
columns[j].sep.getElement().columnIndex = j;
@@ -247,26 +247,12 @@
return true;
},
- _getCellElements: function(cell) {
+ _getCellElements: function(column) {
var details = new Array(3);
- var spans = cell.getElementsByTagName("span");
- var count = spans ? spans.length : 0;
- var el, className;
- for(var i=0; i<count; i++) {
- el = spans[i];
- className = el.className;
- if(className && className.length>0) {
- if(className.indexOf("ClientUI_Grid_HSep")>=0) {
- details[0] = el;
- }
- else if(className.indexOf("sort-desc")>=0) {
- details[1] = el;
- }
- else if(className.indexOf("sort-asc")>=0) {
- details[2] = el;
- }
- }
- }
+ var clientId = this.grid.getElement().id;
+ details[0] = document.getElementById(clientId + ":hsep_" + column);
+ details[1] = document.getElementById(clientId + ":hsortd_" + column);
+ details[2] = document.getElementById(clientId + ":hsorta_" + column);
return details;
},
agjustSeparators: function() {
Modified:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx 2007-06-26
17:26:16 UTC (rev 1329)
+++
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx 2007-06-26
17:54:39 UTC (rev 1330)
@@ -25,8 +25,8 @@
</span>
</td>
<td>
- <span class="sort-desc" />
- <span class="sort-asc" />
+ <span id="#{client_id}:hsortd_#{cell_index}"
class="sort-desc" />
+ <span id="#{client_id}:hsorta_#{cell_index}"
class="sort-asc" />
</td>
</tr>
</tbody>
Show replies by date