Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

jQuery Tablesorter plugin not working

Posted on 2011-09-30
6
Medium Priority
?
1,756 Views
Last Modified: 2012-05-12
Hi,

I'm trying to implement jQuery tablesorter plugin in Coldfusion 9 pages. I can implement it fine on a page without any other .js file includes but when I try to use it in a .cfm that has other .js includes, it doesn't work. I make sure that jQuery is the first .js that is loaded and the css files are all in the right order. But the css does not fully load nor does the .js.

In firebug, I get the following error:

$("#myTable").tablesorter is not a function

I've been struggling with this for almost a day but nothing seems to work. Could someone who's implemented this and had similar issues point me in the right direction?
0
Comment
Question by:roger_v
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 6

Expert Comment

by:ventaur
ID: 36893895
Are you making sure that your call to add table sorter to your table is after the DOM is loaded?

$(function() {
  $("#myTable").tablesorter;
});

Open in new window

0
 
LVL 6

Accepted Solution

by:
ventaur earned 2000 total points
ID: 36893903
...also, include parentheses when calling tablesorter.

$(function() {
  $("#myTable").tablesorter();
});

Open in new window

0
 
LVL 1

Author Comment

by:roger_v
ID: 36894147
@ventaur:

Yes, I have document.ready before I call the tablesorter function. And I do have paren after tablesorter like so: tablesorter();

Here is my .cfm page that first includes another .cfm file that has all the css and .js files in it.

<!---test2.cfm--->
<head>
<cfinclude template="UI_Sorting.cfm">
  <script type="text/javascript">
        $(document).ready(function() {
            $("#myTable").tablesorter();
       });
 </script>
</head>

<body onload="SetPermissions();">


<!---UI_Sorting.cfm--->
<style type="text/css">
            @import url("../styles/tablesorter.css");
            @import url("../styles/jquery.tablesorter.pager.css");
            @import url("../styles/jquery-ui-1.8.14.custom.css");
            
</style>
<script src="../jquery/jquery-1.5.1.min.js" language="javascript"></script>
<script src="../jquery/jquery-ui-1.8.14.custom.min.js" language="javascript"></script>
<script src="../jquery/jquery.tablesorter.min.js" language="javascript"></script>
<script src="../jquery/jquery.tablesorter.pager-mod.js" language="javascript"></script>
<!---xxxx--->

Now, I do have another js function that is run on the onload of the body. Could that be a problem?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:roger_v
ID: 36894157
Nope, I removed the body onload js function but still get this error:

$("#myTable").tablesorter is not a function


I know that jquery is being loaded because I can invoke an alert box in the document.ready function and it works fine. It's just the table sorter function that is a problem.
0
 
LVL 1

Author Closing Comment

by:roger_v
ID: 36894209
Oops, I'm a total idiot on this! I was loading the jquery minified file twice! Thanks for your input though!
0
 
LVL 6

Expert Comment

by:ventaur
ID: 36894591
It happens. Glad you figured it out.
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question