SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2006
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Internet Explorer refuses to execute something twice

    Hey

    http://www.dragons-lair.org/projects/Tree/ , any ideas why the sort stops working after 1 sort , in Internet Explorer ?

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi thedeathart,

    I made a few quick changes to the sort function. It may not be the best way to do it but it should verify if the problem is what I suspect.
    Code:
    Tree.prototype.sort = function(col,order) {
        if(order == 0) {
            this.rows.sort(columnSort0);
        } else {
            this.rows.sort(columnSort1);
        }
        var TDs = this.tableBody.getElementsByTagName('td');
        for(var i=0;i<TDs.length;i++) {
            TDs[i].parentNode.parentNode.removeChild(TDs[i].parentNode);
        }
        this.generateBody();
        // 
        function columnSort0(a,b){
            return (a[col]<b[col])?-1:(a[col]>b[col])?1:0;
        }
        function columnSort1(a,b){
            return (a[col]>b[col])?-1:(a[col]<b[col])?1:0;
        }
    }

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2006
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sweet :-) works.

    btw. what do you mean by this?
    It may not be the best way to do

  4. #4
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, there's nothing wrong with the way I did it - but there's bound to be many ways to do it - and I just went with my first idea


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •