WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 removing arrow image from "None" sort type column, Hee-Do Hong, March 10, 2004
     Re:removing arrow image from , Erik Arvidsson, March 14, 2004

Subject: removing arrow image from "None" sort type column From: Hee-Do Hong Date: March 10, 2004

When you set sort type of a column to "None", you may expect that there is no arrow image and not clickable. But it isn't.
To make it behave like expectation, you should edit "sortabletable.js" file like following:

1.

SortableTable.prototype.initHeader = function (oSortTypes) {
 var cells = this.tHead.rows[0].cells;
 var l = cells.length;
 var img, c;
 for (var i = 0; i < l; i++) {
  c = cells[i];
  img = this.document.createElement("IMG");
  img.src = "/suite/utility/sortabletable/images/blank.png";
  c.appendChild(img);
  if (oSortTypes[i] != null) {
   c._sortType = oSortTypes[i];
  }
  if (typeof c.addEventListener != "undefined")
   c.addEventListener("click", this._headerOnclick, false);
  else if (typeof c.attachEvent != "undefined")
   c.attachEvent("onclick", this._headerOnclick);
  else
   c.onclick = this._headerOnclick;

 }
 this.updateHeaderArrows();
};

should be,

SortableTable.prototype.initHeader = function (oSortTypes) {
 var cells = this.tHead.rows[0].cells;
 var l = cells.length;
 var img, c;
 for (var i = 0; i < l; i++) {
  c = cells[i];
  if (oSortTypes[i] != null && oSortTypes[i] != "None") {
      img = this.document.createElement("IMG");
      img.src = "/suite/utility/sortabletable/images/blank.png";
      c.appendChild(img);
      c._sortType = oSortTypes[i];
      if (typeof c.addEventListener != "undefined")
        c.addEventListener("click", this._headerOnclick, false);
      else if (typeof c.attachEvent != "undefined")
        c.attachEvent("onclick", this._headerOnclick);
      else
        c.onclick = this._headerOnclick;
  }

 }
 this.updateHeaderArrows();
};

2.

SortableTable.prototype.uninitHeader = function () {
 var cells = this.tHead.rows[0].cells;
 var l = cells.length;
 var c;
 for (var i = 0; i < l; i++) {
  c = cells[i];
  c.removeChild(c.lastChild);
  if (typeof c.removeEventListener != "undefined")
   c.removeEventListener("click", this._headerOnclick, false);
  else if (typeof c.detachEvent != "undefined")
   c.detachEvent("onclick", this._headerOnclick);

 }
};

should be,

SortableTable.prototype.uninitHeader = function () {
 var cells = this.tHead.rows[0].cells;
 var l = cells.length;
 var c;
 for (var i = 0; i < l; i++) {
  c = cells[i];
  if (c._sortType != null && c._sortType != "None") {
      c.removeChild(c.lastChild);
      if (typeof c.removeEventListener != "undefined")
        c.removeEventListener("click", this._headerOnclick, false);
      else if (typeof c.detachEvent != "undefined")
        c.detachEvent("onclick", this._headerOnclick);
  }
 }
};

3.

SortableTable.prototype.updateHeaderArrows = function () {
 var cells = this.tHead.rows[0].cells;
 var l = cells.length;
 var img;
 for (var i = 0; i < l; i++) {
  img = cells[i].lastChild;
  if (i == this.sortColumn)
   img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");
  else
   img.className = "sort-arrow";
 }
};

should be,

SortableTable.prototype.updateHeaderArrows = function () {
 var cells = this.tHead.rows[0].cells;
 var l = cells.length;
 var img;
 for (var i = 0; i < l; i++) {
  if (cells[i]._sortType != null && cells[i]._sortType != "None") {
      img = cells[i].lastChild;
      if (i == this.sortColumn)
        img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");
      else
        img.className = "sort-arrow";
  }
 }
};

 

 




Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX