PDA

View Full Version : Change memberlist sort default column


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

richy96
10-07-2010, 12:50 PM
Anyone here know a bit more about javascript than me? shouldn't be too difficult lol

kh99
10-08-2010, 05:57 PM
I wanted to try to help with this (partly so I'd have an excuse to learn some jquery), but I'm confused - the only members list I can find doesn't have any javascript sorting. Which list do you mean?

BirdOPrey5
10-09-2010, 11:28 PM
jquery isn't used in vb 3.x at all as far as I know, are you sure it's not 4.x? If it is 3.x it must be something custom.

richy96
11-04-2010, 06:27 PM
Hi
Yes it turned out thta stuff was custom put in by a programmer who worked on the site a while ago

I did manage to fix this problem

It took me about a week to brush up on enough javascript and jquery to be able to do it though

Rich