richy96
10-05-2010, 05:28 PM
Hi
I want to change the default column that memberlist sorts on
At the moment it by default sorts on joined date, obviously by clicking the column headers I can sort by any other column. I even managed in a previous mod to add a custom user field and can sort by that column too
What I want to do is change the default so it does not sort by joined date but by last logged in.
HAving done a bit of research myself I understand vbulletin uses jquery and a plugin called tablesorter to do the client side sorting of memberlists, and I also have the bit of code I I think I need to add to the html head
table.tablesorter({
sortList: [x,y]
});
where x is the column number starting from 0 and y is the order (0 ascending 1 descending)
I've tried putting this into the memberlist template just after it sets up all the column header icons, but it didn't work
Have I put it in the wrong place or did I simply misunderstand what I need to do?
I can't find any template which sets sortList to column 1 (joindate) by default either!
confused but hopeful :confused:
rich
VB3.7.0
--------------- Added 1286389330 at 1286389330 ---------------
HI folks
I've played around a little more with this
I now have this in the memberlist template
$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions - $vbphrase[members_list]</title>
[B]
<script type="text/javascript">
$(document).ready(function(){
$("table").tablesorter({
sortList: [2,0]
});
});
</script>
<style type="text/css" src="tablesorterstyle.css"></style>
<style type="text/css">
#modWrapper
{
display:none;
}
table.tablesorter {
font-family:arial;
background-color: #CDCDCD;
margin:10px 0pt 15px;
font-size: 8pt;
width: 100%;
text-align: left;
}
blah..............
blah..............
..............
But all it seems to do is stop the javascript tablesorter from working at all
I also tride
<script type="text/javascript">
$(document).ready(function(){
table.tablesorter({
sortList: [2,0]
});
});
</script>
As I am not sure what the difference with $("table").tablesorter and table.tablesorter is?
However this also stopped the javascript/tablesorter from working all together
Vieiwing the html page source it seems to put the document.ready function in the <head> section of the page as I would have expected.
Can anyone please tell me what I am doing wrong here - I am not very good with javascript yet as I am only a beginner, but from what I have found on the net this should work?
Cheers
Rich
I want to change the default column that memberlist sorts on
At the moment it by default sorts on joined date, obviously by clicking the column headers I can sort by any other column. I even managed in a previous mod to add a custom user field and can sort by that column too
What I want to do is change the default so it does not sort by joined date but by last logged in.
HAving done a bit of research myself I understand vbulletin uses jquery and a plugin called tablesorter to do the client side sorting of memberlists, and I also have the bit of code I I think I need to add to the html head
table.tablesorter({
sortList: [x,y]
});
where x is the column number starting from 0 and y is the order (0 ascending 1 descending)
I've tried putting this into the memberlist template just after it sets up all the column header icons, but it didn't work
Have I put it in the wrong place or did I simply misunderstand what I need to do?
I can't find any template which sets sortList to column 1 (joindate) by default either!
confused but hopeful :confused:
rich
VB3.7.0
--------------- Added 1286389330 at 1286389330 ---------------
HI folks
I've played around a little more with this
I now have this in the memberlist template
$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions - $vbphrase[members_list]</title>
[B]
<script type="text/javascript">
$(document).ready(function(){
$("table").tablesorter({
sortList: [2,0]
});
});
</script>
<style type="text/css" src="tablesorterstyle.css"></style>
<style type="text/css">
#modWrapper
{
display:none;
}
table.tablesorter {
font-family:arial;
background-color: #CDCDCD;
margin:10px 0pt 15px;
font-size: 8pt;
width: 100%;
text-align: left;
}
blah..............
blah..............
..............
But all it seems to do is stop the javascript tablesorter from working at all
I also tride
<script type="text/javascript">
$(document).ready(function(){
table.tablesorter({
sortList: [2,0]
});
});
</script>
As I am not sure what the difference with $("table").tablesorter and table.tablesorter is?
However this also stopped the javascript/tablesorter from working all together
Vieiwing the html page source it seems to put the document.ready function in the <head> section of the page as I would have expected.
Can anyone please tell me what I am doing wrong here - I am not very good with javascript yet as I am only a beginner, but from what I have found on the net this should work?
Cheers
Rich