Wikia

Community Central

WatchlistRandom pageRecent changes

Images in "sortable" tables

63,452pages on
this wiki

Forum page

Forums: Index Watercooler Images in "sortable" tables
Wikia's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Note: This topic has been unedited for 1878 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.


In tables in which one column is an image (with no text, but the image has the proper alt attribute, which is its text-equivalent) the sorttable extension does not take care of the alt attribute, and the sorting of that column is never done.

I've made a hack to improve the functionality of sorting cells with images (in w:c:es.pokemon:MediaWiki:Common.js#Obtención de texto mejorada), replacing the function that gets the text of the cell with a customized one, but it could be applied to the default js [1] of all wikia to fix this issue.

An example of a table with a column of images sortables is at w:c:es.pokemon:Lista de Pokémon --Ciencia Al Podertalk-@WikiDex 19:29, 23 March 2007 (UTC)

Okay, the last week, all the javascript functions involved in the "sortable tables" extension were placed into the wikibits.js file. Today, these functions are placed in a file called sorttable.js which is loaded only when a table with class="sortable" is found within the document. But now, it throws a javascript error when attempting to sort a column with only images in that line:
 for( var i = 1, itm = ""; itm.match(/^([\s]|\n|\ |<!--[^-]+-->)*$/); i++) {
    var itm = ts_getInnerText(table.tBodies[0].rows[i].cells[column]);
    itm = trim(itm);
 }
because there's no tbodies in a wiki table. So, the patch I'd done is now useless :( . Is there any possibilities that if I submit some improvements to this file, the sorttable.js file would be updated? Or it must be done with a patch on the local wikia like I'd done before? --Ciencia Al Podertalk-@WikiDex 18:46, 30 March 2007 (UTC)
The problem wasn't the tbodies. The problem is the ts_getInnerText function, which returns an empty string if the cell contains only images, or the cell is empty. If all the cells of that column contains only images or are empty, the for runs out of the range of cells, and the script crashes. Now that's fixed locally in es.pokemon so it doesn't matter. --Ciencia Al Podertalk-@WikiDex 09:11, 1 April 2007 (UTC)

Around Wikia's network

Random Wiki