Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6237771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:05:33+00:00 2026-05-24T11:05:33+00:00

Due to Ajax loaded content, I had to change a function from: document.observe(‘dom:loaded’,function() {

  • 0

Due to Ajax loaded content, I had to change a function from:

document.observe('dom:loaded',function() {    
    $$('.userListHeaderCell').invoke('observe', 'click', function() {       
        this.toggleClassName('desc');        
        var colnumber = this.up().childElements().indexOf(this);        
        var content = this.up(2); 
        sortColumn(content, colnumber, this.hasClassName('desc'));    
    });
});

TO:

document.observe('click', function(e, el) {  
    if (el = e.findElement('.userListHeaderCell.sortable')) { 
        el.toggleClassName('desc');        
        var colnumber = el.up().childElements().indexOf(el);        
        var content = el.up(2); 
        sortColumn(content, colnumber, el.hasClassName('desc'));   
    }
});

The sortColumn looks like:

function sortColumn(content, colnumber, desc) {    
    content.select('.userListRow').sort(function(a,b){        
        var atext = a.down(colnumber).innerHTML.stripTags().toLowerCase();        
        var btext = b.down(colnumber).innerHTML.stripTags().toLowerCase();        
        return atext.localeCompare(btext) * (desc ? -1 : 1);    
    }).each(Element.prototype.appendChild, content);
}

The toggle and colnumber work and content is an object HTMLDivElement, but it seems that I need to convert the content variable or use another function, but not sure what in the sortColumn. The error I get is:

“Could not convert JavaScript argument” nsresult: “0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)” location: “JS frame :: https://www.someurl.com/scripts/prototype.js :: :: line 804″ data: no]

What do I need to change in order to make this work?

Thanks.

EDIT:

Error in IE shows:
Unable to get value of the property ‘call’: object is null or undefined prototype.js, line 804 character 9

I believe the issue is with Element.prototype.appendChild

Tried adding Element.extend(content), but doesn’t seem to help.

Example data:

<div id="contentbox_Users" class="userList">
    <div class="userListHeader">
        <div class="userListHeaderCell col1 sortable">First Name</div>
        <div class="userListHeaderCell col2 sortable">Last Name</div>
    </div>
    <div id="contentbox_People">
        <div class="userListRow">
            <div class="userListCell col1">John</div>
            <div class="userListCell col2">Smith</div>
        </div>
        <div class="userListRow">
            <div class="userListCell col1">Bob</div>
            <div class="userListCell col2">Ray</div>
        </div>
        <div class="userListRow">
            <div class="userListCell col1">Fred</div>
            <div class="userListCell col2">Jones</div>
        </div>
    </div>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:05:34+00:00Added an answer on May 24, 2026 at 11:05 am

    Since it is my code that is failing I should have a go.

    The line,

    }).each(Element.prototype.appendChild, content);
    

    is a shorthand way of saying,

    }).each(function(row) {
        content.appendChild(row);
    });
    

    You can try it that way to see if things are better. I don’t recognise the error but a quick google suggests it is from Firefox and relates to passing a non-element to a native function that expects one. In situations such as this I tend to stick lots of console.log(...) calls everywhere (and press F12 in Firefox) and see what happens. Logging the array should show all the rows as HTML elements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$.ajax({ url: plugin.js, dataType: 'script', cache: true, success: function() { alert('loaded'); }}); 1) I
Say I'm using the following Ajax call: $(document).ready(function () { $.ajax({ type: GET, url:
Due to the change in CSRF-policy for AJAX requests since Django 1.2.5, all implementations
I'm using an older version of ASP.NET AJAX due to runtime limitations, Placing a
Using jQuery's $.ajax() function. Wherether the request has been purposely aborted, or if the
I have a dialog that's loaded via ajax. The paylaod of that ajax contains
I am using JQuery ajax for authenticating username and password, however due to security
I'm testing an Ajax/jQuery-loaded PHP module and I was wondering if there's a simple
I'm currently developing a webinterface for XBMC witch contains ajax. Due the limitations of
Im using struts2 and also servlets. (Due to a 3rd party ajax thing that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.