vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Change memberlist sort default column (https://vborg.vbsupport.ru/showthread.php?t=251685)

richy96 10-05-2010 05:28 PM

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 :confused:
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

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


All times are GMT. The time now is 08:02 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01052 seconds
  • Memory Usage 1,721KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (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_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete