View Single Post
  #1  
Old 10-05-2010, 05:28 PM
richy96's Avatar
richy96 richy96 is offline
 
Join Date: Apr 2008
Location: England
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Change memberlist sort default column

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
rich
VB3.7.0

--------------- Added [DATE]1286389330[/DATE] at [TIME]1286389330[/TIME] ---------------

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[bbtitle] - $vbphrase[members_list]</title>


<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
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01395 seconds
  • Memory Usage 1,770KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete