jsTableSorter 插件不应用样式 [英] jsTableSorter plugin does not apply style

查看:33
本文介绍了jsTableSorter 插件不应用样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用带有 Blue 主题的 jsTableSorter 插件.不幸的是,以下代码不适用于该样式.请您帮我找出问题所在.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><头><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><link rel="快捷图标" href="http://i56.servimg.com/u/f56/18/49/06/85/pcicon10.png"/><标题>宝可俱乐部!排行<link rel="stylesheet" type="text/css" href="http://dl.dropboxusercontent.com/s/5sckq157asnl68z/pcranking.css"/><link rel="stylesheet" type="text/css" href="http://dl.dropboxusercontent.com/s/799k8f76ukikxa8/style.css"/><script type="text/javascript" src="http://dl.dropboxusercontent.com/s/5c8cuzcww0bjua4/jquery-latest.js"></script><script type="text/javascript" src="http://dl.dropboxusercontent.com/s/2gbxvhkskdsch5p/jquery.tablesorter.js"></script><script type="text/javascript">var jsonData = JSON.stringify([{教练:CLBGM",胜利:9,损失:13}, {培训师:Galakthor",胜利:26,损失:18}, {教练:乔伊",胜利:20,损失:21}, {培训师:Matiaz98",胜利:18,损失:12}, {培训师:PokeCraftMariano",胜利:16,损失:14}, {培训师:Rockemc",胜利:23,损失:17}]);var ScoreTable = (function () {功能评分表(教练,赢,输){this.position = '';this.trainer = 教练;this.win = 赢;this.loss = 损失;this.battles = this.win + this.loss;this.winrate = this.win/this.battles;this.rating = this.win * 7 - this.loss * 3;}返回分数表;})();函数 getColumn(value) {return $('<td>' + value + '</td>');}函数 addRow(item) {var row = $("");$("tbody").append(row);row.append(getColumn(item.position));row.append(getColumn(item.trainer));row.append(getColumn(item.battles));row.append(getColumn(item.win));row.append(getColumn(item.loss));row.append(getColumn((item.winrate * 100).toFixed(0) + '%'));row.append(getColumn(item.rating));}函数填充(数据){for (var i = 0; i < data.length; i++) {var item = new ScoreTable(data[i].trainer, data[i].win, data[i].loss);添加行(项目);}}$(document).ready(function () {method1Parse();//method2Ajax();种类();});函数 method1Parse() {var parsedData = $.parseJSON(jsonData);填充(解析数据);}函数 method2Ajax() {//jsFiddle 以不同方式处理 AJAX 请求(返回您发送的值)您可以在 http://doc.jsfiddle.net/use/echo.html 中找到更多详细信息$.ajax({url: '/echo/json/',类型:帖子",数据类型:json",数据: {json: jsonData,延迟:1},成功:功能(数据){填充(数据);}});}$.tablesorter.addWidget({id: "编号",格式:函数(表){var c = table.config;$("tr:visible", table.tBodies[0]).each(function(i) {$(this).find('td').eq(0).text(i + 1);});}});功能排序(){$('table').tablesorter({//*** 外貌 ***//添加一个主题 - 尝试 'blackice', 'blue', 'dark', 'default'//'dropbox', 'green', 'grey' 或 'ice'//要使用bootstrap"或jui",您需要添加uitheme"//小部件并将其设置为相同的名称//这个选项只添加了一个表类名tablesorter-{theme}"主题:'默认',//固定列宽宽度固定:假,//当表格出现时,在标题中显示一个不确定的计时器图标//已排序或过滤显示处理:假,//标题布局模板 (HTML ok);{content} = 内部 HTML,//{icon} = <i/>(来自 cssIcon 的类)headerTemplate: '{content}',//返回修改后的模板字符串onRenderTemplate: null,//function(index, template){ return template;},//在呈现每个标题单元格后调用,使用索引定位列//自定义标题 HTMLonRenderHeader:函数(索引){//默认情况下添加跨度包装器$(this).find('div.tablesorter-header-inner').addClass('roundedCorners');},//*** 功能 ***//防止标题中的文本选择取消选择:真,//其他选项:"ddmmyyyy" &yyyymmdd"dateFormat: "mmddyyyy",//用于多列选择多列的key//排序.sortMultiSortKey: "shiftKey",//用于删除列排序的键sortResetKey: 'ctrlKey',//德语1.234.567,89"或法语1 234 567,89"为假usNumberFormat: 真,//如果为true,所有表格单元格数据的解析将被延迟//直到用户初始化排序延迟初始化:假,//如果为 true,则应执行服务器端排序,因为//客户端排序将被禁用,但用户界面和事件//仍将被使用.服务器端排序:假,//*** 排序选项 ***//默认情况下会检测到这些,//但您可以更改或禁用它们//这些也可以使用数据属性或类名设置标题:{//设置sorter : false"(无引号)以禁用该列0:{分拣机:假},1:{排序器:文本"},2:{分拣机:数字"},3:{分拣机:数字"},4:{分拣机:数字"},5:{分拣机:数字"},6:{分拣机:数字"}},//排序时忽略大小写忽略大小写:真,//强制用户首先对这个/这些列进行排序sortForce:空,//列的初始排序顺序,例如 sortList: [[0,0],[1,0]],//[[columnIndex, sortDirection], ... ]排序列表:[[6, 1],],//添加到用户排序末尾的默认排序//选择.sortAppend:空,//开始排序方向asc"或desc"sortInitialOrder: "asc",//替换等效字符(重音字符)以允许//用于字母数字排序sortLocaleCompare:假,//第三次单击标题会将列重置为默认值 - 未排序sortReset:假,//之前点击时重新排序到sortInitialOrder"//未排序的列sortRestart: 真,//将空单元格排序为底部、顶部、无、零emptyTo: "底部",//将数字列中的字符串排序为最大值、最小值、顶部、底部、零stringTo: "最大",//从表中提取文本 - 这是如何//默认完成文本提取:{1:函数(节点){返回 $(node).text();}},//使用自定义文本排序器//function(a,b){ return a.sort(b);}//基本排序文本排序器:空,//*** 小部件 ***//在 tablesorter 初始化时应用小部件initWidgets: 真,//包括 zebra 和任何其他小部件,选项://'columns', 'filter', 'stickyHeaders' &'可调整大小'//'uitheme' 是另一个小部件,但需要加载//不同的皮肤和 jQuery UI 主题.小部件:['编号','斑马','列'],小部件选项:{//斑马小部件:添加斑马条纹,使用内容和//默认样式 - ui css 移除背景//来自为此包含的默认偶数和奇数类名//演示允许切换主题//[ "偶数", "奇数" ]斑马:["ui-widget-content 甚至",ui-state-default 奇数"],//uitheme 小部件:* 更新!在 tablesorter v2.4 **//而不是图标类名称的数组,这个选项现在//包含主题的名称.当前 jQuery UI(jui")//并且支持 Bootstrap ("bootstrap") 主题.修改//使用的类名,从主题变量扩展//寻找下面的$.extend($.tablesorter.themes.jui"代码uitheme: 'jui',//列小部件:更改默认列类名称//主要是排序的第一列,次要是第二列,依此类推列: [基本的","次要",第三"],//列小部件:如果为 true,则列中的类名//选项也将被添加到表 tfoot.columns_tfoot: 真,//列小部件:如果为 true,则列中的类名//选项也将被添加到表头中.columns_thead:真,//过滤小部件:如果表中有子行(行//来自cssChildRow"选项的类名)并且此选项为真//并且在子行中的任何位置找到匹配项,那么它将使//该行可见;默认为假filter_childRows:假,//过滤器小部件:如果为真,过滤器将被添加到顶部//每个表格列.filter_columnFilters: 真,//过滤器小部件:应用于包含表行的 css 类//过滤器 &该行中的输入filter_cssFilter: "tablesorter-filter",//过滤器小部件:通过添加选择自定义过滤器小部件//带有内容、自定义选项或自定义过滤器功能的下拉菜单//请参阅 http://goo.gl/HQQLW 了解更多详情filter_functions:空,//过滤器小部件:将此选项设置为 true 以隐藏过滤器行//最初.通过将鼠标悬停在过滤器上来显示行//行或给予任何过滤器输入/选择焦点.filter_hideFilters: 假,//过滤小部件:将此选项设置为false以保留搜索//区分大小写filter_ignoreCase: 真,//过滤小部件:用于元素的 jQuery 选择器字符串//重置过滤器.filter_reset:空,//过滤器小部件开始搜索之前的延迟(以毫秒为单位);//此选项可防止在键入时搜索每个字符//并且应该可以更快地搜索大表.filter_searchDelay: 300,//如果在服务器端执行过滤,则将此选项设置为 true.filter_serversideFiltering: 假,//过滤小部件:将此选项设置为true以使用过滤器查找//列开头的文本.所以输入a"会发现//"albert" 但不是 "frank",两者都有一个;默认为假filter_startsWith: 假,//过滤器小部件:如果为真,所有过滤器搜索将只使用已解析的//数据.要仅使用特定列中的解析数据,请设置此选项//为 false 并将类名filter-parsed"添加到标题中filter_useParsedData: 假,//可调整大小的小部件:如果此选项设置为 false,则调整列的大小//宽度不会被保存.之前保存的值将被恢复//在页面重新加载可调整大小:真实,//saveSort 小部件:如果此选项设置为 false,则新排序将//不被保存.任何以前保存的排序将在页面上恢复//重新加载.保存排序:真,//stickyHeaders 小部件:应用于粘性标题的 css 类名stickyHeaders: "tablesorter-stickyHeader"},//*** 回调 ***//tablesorter 完成初始化后调用的函数初始化:函数(表){},//*** CSS 类名 ***tableClass: 'tablesorter',cssAsc: "tablesorter-headerSortUp",cssDesc: "tablesorter-headerSortDown",cssHeader: "tablesorter-header",cssHeaderRow: "tablesorter-headerRow",cssIcon: "tablesorter-icon",cssChildRow: "tablesorter-childRow",cssInfoBlock: "tablesorter-infoOnly",cssProcessing: "tablesorter-processing",//*** 选择器 ***//用于查找标题单元格的 jQuery 选择器.选择器标题:'>头日,>头td',//selectorHeaders 中内容的 jQuery 选择器//可点击以触发排序.selectorSort: "th, td",//具有此类名称的行将被自动删除//在更新表缓存之前 - 由更新"使用,//"addRows" 和 "appendCache"selectorRemove: "tr.remove-me",//*** 调试 ***//向控制台发送消息调试:真});//扩展主题以更改任何默认类名 ** NEW **$.extend($.tablesorter.themes.jui, {//更改默认的 jQuery uitheme 图标 - 找到完整的图标列表//这里:http://jqueryui.com/themeroller/(将鼠标悬停在他们的名字上)table: 'ui-widget ui-widget-content ui-corner-all',//表类header: 'ui-widget-header ui-corner-all ui-state-default',//头类icons: 'ui-icon',//图标类添加到<i>在标题中sortNone: 'ui-icon-carat-2-n-s',sortAsc: 'ui-icon-carat-1-n',sortDesc: 'ui-icon-carat-1-s',active: 'ui-state-active',//在列排序时应用hover: 'ui-state-hover',//悬停类过滤器行:'',even: 'ui-widget-content',//偶数行斑马条纹奇数: 'ui-state-default'//奇数行斑马条纹});}<身体><div id="包裹"><table id="dataTable" class="tablesorter"><头><tr><th>位置</th><th>培训师</th><th>Battles</th><th>胜</th><th>损失</th><th>赢率</th><th>评级</th></tr></thead><tbody id="dataTableBody"></tbody>

<a id="regresar" href="http://www.pokeclub.net/forum">Regresar al Foro</a><noscript>Parece que tu navegador no soporta JavaScript!Actívalo para poder visualizar está página ;)</noscript></html>

.........................................................................

解决方案

你的 jQuery 是 v1.4.2,你的 tableSorter 版本是 2.05b 和你的 CSS 有很多缺失的部分.如果您真的不需要使用这些版本,这里是解决方案.

替换以下几行

<link rel="stylesheet" type="text/css" href="http://dl.dropboxusercontent.com/s/799k8f76ukikxa8/style.css"/><script type="text/javascript" src="http://dl.dropboxusercontent.com/s/5c8cuzcww0bjua4/jquery-latest.js"></script><script type="text/javascript" src="http://dl.dropboxusercontent.com/s/2gbxvhkskdsch5p/jquery.tablesorter.js"></script>

<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.1/css/theme.blue.css"><script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.1/jquery.tablesorter.min.js"></script><script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.1/jquery.tablesorter.widgets.min.js"></脚本>

还有这个

主题:'默认',

主题:'蓝色',

只是指出了 CDN 中的最新版本,并更改​​了评论中指出的主题名称.

I'm trying to use jsTableSorter plug-in with Blue theme. Unfortunately following code doesn't apply the style. Would you please help me to locate the issue.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="shortcut icon" href="http://i56.servimg.com/u/f56/18/49/06/85/pcicon10.png" />
    <title>
      PokéClub! Ranking
    </title>
    <link rel="stylesheet" type="text/css" href="http://dl.dropboxusercontent.com/s/5sckq157asnl68z/pcranking.css" />    
    <link rel="stylesheet" type="text/css" href="http://dl.dropboxusercontent.com/s/799k8f76ukikxa8/style.css" />
    <script type="text/javascript" src="http://dl.dropboxusercontent.com/s/5c8cuzcww0bjua4/jquery-latest.js"></script>
    <script type="text/javascript" src="http://dl.dropboxusercontent.com/s/2gbxvhkskdsch5p/jquery.tablesorter.js"></script>
    <script type="text/javascript">
      var jsonData = JSON.stringify([{
    trainer: "CLBGM",
    win: 9,
    loss: 13
}, {
    trainer: "Galakthor",
    win: 26,
    loss: 18
}, {
    trainer: "JOOY",
    win: 20,
    loss: 21
}, {
    trainer: "Matiaz98",
    win: 18,
    loss: 12
}, {
    trainer: "PokeCraftMariano",
    win: 16,
    loss: 14
}, {
    trainer: "Rockemc",
    win: 23,
    loss: 17
}]);

var ScoreTable = (function () {
    function scoreTable(trainer, win, loss) {
        this.position = '';
        this.trainer = trainer;
        this.win = win;
        this.loss = loss;
        this.battles = this.win + this.loss;
        this.winrate = this.win / this.battles;
        this.rating = this.win * 7 - this.loss * 3;
    }
    return scoreTable;
})();

function getColumn(value) {
    return $('<td>' + value + '</td>');
}

function addRow(item) {
    var row = $("<tr />");
    $("tbody").append(row);

    row.append(getColumn(item.position));
    row.append(getColumn(item.trainer));
    row.append(getColumn(item.battles));
    row.append(getColumn(item.win));
    row.append(getColumn(item.loss));
    row.append(getColumn((item.winrate * 100).toFixed(0) + '%'));
    row.append(getColumn(item.rating));
}

function populate(data) {
    for (var i = 0; i < data.length; i++) {
        var item = new ScoreTable(data[i].trainer, data[i].win, data[i].loss);
        addRow(item);
    }
}

$(document).ready(function () {
    method1Parse();
    //method2Ajax();
    sort();
});

function method1Parse() {
    var parsedData = $.parseJSON(jsonData);
    populate(parsedData);
}

function method2Ajax() {
    // jsFiddle handles AJAX requests differently (returns the value that you sent)  you may find more details in http://doc.jsfiddle.net/use/echo.html

    $.ajax({
        url: '/echo/json/',
        type: "post",
        dataType: "json",
        data: {
            json: jsonData,
            delay: 1
        },
        success: function (data) {
            populate(data);
        }
    });
}

$.tablesorter.addWidget({
    id: "numbering",
    format: function(table) {
        var c = table.config;
        $("tr:visible", table.tBodies[0]).each(function(i) {
            $(this).find('td').eq(0).text(i + 1);
        });
    }
});

function sort() {
    $('table').tablesorter({

        // *** APPEARANCE ***
        // Add a theme - try 'blackice', 'blue', 'dark', 'default'
        //  'dropbox', 'green', 'grey' or 'ice'
        // to use 'bootstrap' or 'jui', you'll need to add the "uitheme"
        // widget and also set it to the same name
        // this option only adds a table class name "tablesorter-{theme}"
        theme: 'default',

        // fix the column widths
        widthFixed: false,

        // Show an indeterminate timer icon in the header when the table
        // is sorted or filtered
        showProcessing: false,

        // header layout template (HTML ok); {content} = innerHTML,
        // {icon} = <i/> (class from cssIcon)
        headerTemplate: '{content}',

        // return the modified template string
        onRenderTemplate: null, // function(index, template){ return template; },

        // called after each header cell is rendered, use index to target the column
        // customize header HTML
        onRenderHeader: function (index) {
            // the span wrapper is added by default
            $(this).find('div.tablesorter-header-inner').addClass('roundedCorners');
        },

        // *** FUNCTIONALITY ***
        // prevent text selection in header
        cancelSelection: true,

        // other options: "ddmmyyyy" & "yyyymmdd"
        dateFormat: "mmddyyyy",

        // The key used to select more than one column for multi-column
        // sorting.
        sortMultiSortKey: "shiftKey",

        // key used to remove sorting on a column
        sortResetKey: 'ctrlKey',

        // false for German "1.234.567,89" or French "1 234 567,89"
        usNumberFormat: true,

        // If true, parsing of all table cell data will be delayed
        // until the user initializes a sort
        delayInit: false,

        // if true, server-side sorting should be performed because
        // client-side sorting will be disabled, but the ui and events
        // will still be used.
        serverSideSorting: false,

        // *** SORT OPTIONS ***
        // These are detected by default,
        // but you can change or disable them
        // these can also be set using data-attributes or class names
        headers: {
            // set "sorter : false" (no quotes) to disable the column
            0: {
                sorter: false
            },
            1: {
                sorter: "text"
            },
            2: {
                sorter: "digit"
            },
            3: {
                sorter: "digit"
            },
            4: {
                sorter: "digit"
            },
            5: {
                sorter: "digit"
            },
            6: {
                sorter: "digit"
            }
        },

        // ignore case while sorting
        ignoreCase: true,

        // forces the user to have this/these column(s) sorted first
        sortForce: null,
        // initial sort order of the columns, example sortList: [[0,0],[1,0]],
        // [[columnIndex, sortDirection], ... ]
        sortList: [
            [6, 1],
        ],
        // default sort that is added to the end of the users sort
        // selection.
        sortAppend: null,

        // starting sort direction "asc" or "desc"
        sortInitialOrder: "asc",

        // Replace equivalent character (accented characters) to allow
        // for alphanumeric sorting
        sortLocaleCompare: false,

        // third click on the header will reset column to default - unsorted
        sortReset: false,

        // restart sort to "sortInitialOrder" when clicking on previously
        // unsorted columns
        sortRestart: true,

        // sort empty cell to bottom, top, none, zero
        emptyTo: "bottom",

        // sort strings in numerical column as max, min, top, bottom, zero
        stringTo: "max",

        // extract text from the table - this is how is
        // it done by default
        textExtraction: {
            1: function (node) {
                return $(node).text();
            }
        },

        // use custom text sorter
        // function(a,b){ return a.sort(b); } // basic sort
        textSorter: null,

        // *** WIDGETS ***

        // apply widgets on tablesorter initialization
        initWidgets: true,

        // include zebra and any other widgets, options:
        // 'columns', 'filter', 'stickyHeaders' & 'resizable'
        // 'uitheme' is another widget, but requires loading
        // a different skin and a jQuery UI theme.
        widgets: ['numbering', 'zebra', 'columns'],

        widgetOptions: {

            // zebra widget: adding zebra striping, using content and
            // default styles - the ui css removes the background
            // from default even and odd class names included for this
            // demo to allow switching themes
            // [ "even", "odd" ]
            zebra: [
                "ui-widget-content even",
                "ui-state-default odd"],

            // uitheme widget: * Updated! in tablesorter v2.4 **
            // Instead of the array of icon class names, this option now
            // contains the name of the theme. Currently jQuery UI ("jui")
            // and Bootstrap ("bootstrap") themes are supported. To modify
            // the class names used, extend from the themes variable
            // look for the "$.extend($.tablesorter.themes.jui" code below
            uitheme: 'jui',

            // columns widget: change the default column class names
            // primary is the 1st column sorted, secondary is the 2nd, etc
            columns: [
                "primary",
                "secondary",
                "tertiary"],

            // columns widget: If true, the class names from the columns
            // option will also be added to the table tfoot.
            columns_tfoot: true,

            // columns widget: If true, the class names from the columns
            // option will also be added to the table thead.
            columns_thead: true,

            // filter widget: If there are child rows in the table (rows with
            // class name from "cssChildRow" option) and this option is true
            // and a match is found anywhere in the child row, then it will make
            // that row visible; default is false
            filter_childRows: false,

            // filter widget: If true, a filter will be added to the top of
            // each table column.
            filter_columnFilters: true,

            // filter widget: css class applied to the table row containing the
            // filters & the inputs within that row
            filter_cssFilter: "tablesorter-filter",

            // filter widget: Customize the filter widget by adding a select
            // dropdown with content, custom options or custom filter functions
            // see http://goo.gl/HQQLW for more details
            filter_functions: null,

            // filter widget: Set this option to true to hide the filter row
            // initially. The rows is revealed by hovering over the filter
            // row or giving any filter input/select focus.
            filter_hideFilters: false,

            // filter widget: Set this option to false to keep the searches
            // case sensitive
            filter_ignoreCase: true,

            // filter widget: jQuery selector string of an element used to
            // reset the filters.
            filter_reset: null,

            // Delay in milliseconds before the filter widget starts searching;
            // This option prevents searching for every character while typing
            // and should make searching large tables faster.
            filter_searchDelay: 300,

            // Set this option to true if filtering is performed on the server-side.
            filter_serversideFiltering: false,

            // filter widget: Set this option to true to use the filter to find
            // text from the start of the column. So typing in "a" will find
            // "albert" but not "frank", both have a's; default is false
            filter_startsWith: false,

            // filter widget: If true, ALL filter searches will only use parsed
            // data. To only use parsed data in specific columns, set this option
            // to false and add class name "filter-parsed" to the header
            filter_useParsedData: false,

            // Resizable widget: If this option is set to false, resized column
            // widths will not be saved. Previous saved values will be restored
            // on page reload
            resizable: true,

            // saveSort widget: If this option is set to false, new sorts will
            // not be saved. Any previous saved sort will be restored on page
            // reload.
            saveSort: true,

            // stickyHeaders widget: css class name applied to the sticky header
            stickyHeaders: "tablesorter-stickyHeader"

        },

        // *** CALLBACKS ***
        // function called after tablesorter has completed initialization
        initialized: function (table) {},

        // *** CSS CLASS NAMES ***
        tableClass: 'tablesorter',
        cssAsc: "tablesorter-headerSortUp",
        cssDesc: "tablesorter-headerSortDown",
        cssHeader: "tablesorter-header",
        cssHeaderRow: "tablesorter-headerRow",
        cssIcon: "tablesorter-icon",
        cssChildRow: "tablesorter-childRow",
        cssInfoBlock: "tablesorter-infoOnly",
        cssProcessing: "tablesorter-processing",

        // *** SELECTORS ***
        // jQuery selectors used to find the header cells.
        selectorHeaders: '> thead th, > thead td',

        // jQuery selector of content within selectorHeaders
        // that is clickable to trigger a sort.
        selectorSort: "th, td",

        // rows with this class name will be removed automatically
        // before updating the table cache - used by "update",
        // "addRows" and "appendCache"
        selectorRemove: "tr.remove-me",

        // *** DEBUGING ***
        // send messages to console
        debug: true

    });

    // Extend the themes to change any of the default class names ** NEW **
    $.extend($.tablesorter.themes.jui, {
        // change default jQuery uitheme icons - find the full list of icons
        // here: http://jqueryui.com/themeroller/ (hover over them for their name)
        table: 'ui-widget ui-widget-content ui-corner-all', // table classes
        header: 'ui-widget-header ui-corner-all ui-state-default', // header classes
        icons: 'ui-icon', // icon class added to the <i> in the header
        sortNone: 'ui-icon-carat-2-n-s',
        sortAsc: 'ui-icon-carat-1-n',
        sortDesc: 'ui-icon-carat-1-s',
        active: 'ui-state-active', // applied when column is sorted
        hover: 'ui-state-hover', // hover class
        filterRow: '',
        even: 'ui-widget-content', // even row zebra striping
        odd: 'ui-state-default' // odd row zebra striping
    });
}
    </script>
  </head>
  <body>
    <div id="wrap">
    <table id="dataTable" class="tablesorter">
    <thead>
        <tr>
            <th>Position</th>
            <th>Trainer</th>
            <th>Battles</th>
            <th>Wins</th>
            <th>Losses</th>
            <th>Win Rate</th>
            <th>Rating</th>
        </tr>
    </thead>
    <tbody id="dataTableBody"></tbody>
</table>
    </div>
    <a id="regresar" href="http://www.pokeclub.net/forum">Regresar al Foro</a>
    <noscript>Parece que tu navegador no soporta JavaScript! Actívalo para poder visualizar está página ;)</noscript>
  </body>
</html>

.......................................................................................

解决方案

Your jQuery is v1.4.2 and your tableSorter version is 2.05b and your CSS has many missing parts. Here is the solution if you do not really need to work with those versions.

replace following lines

<link rel="stylesheet" type="text/css" href="http://dl.dropboxusercontent.com/s/799k8f76ukikxa8/style.css" />
<script type="text/javascript" src="http://dl.dropboxusercontent.com/s/5c8cuzcww0bjua4/jquery-latest.js"></script>
<script type="text/javascript" src="http://dl.dropboxusercontent.com/s/2gbxvhkskdsch5p/jquery.tablesorter.js"></script>

with

<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.1/css/theme.blue.css">    
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.1/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.1/jquery.tablesorter.widgets.min.js"></script>

and this one

theme: 'default',

with

theme: 'blue',

just pointed the latest versions from a CDN and changed the theme name as it points out in comment.

这篇关于jsTableSorter 插件不应用样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆