Jquery tablesort将第一个字符留在表的底部

时间:2017-06-24 11:38:53

标签: jquery sorting

我有一张桌子。

我想通过第二列DESC回显数据。

这与这行代码非常吻合:

sortList: [[1, 1]]

http://imgur.com/a/KZxSh

问题是,每个名称的标题字符都在表的底部。如何删除它们?

这是我的代码:

 <script type="text/javascript" src="<?= base_url() ?>public_html/js/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="<?= base_url() ?>public_html/js/jquery.tablesorter.widgets.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {

            function getTextExtractor() {
                return (function () {
                    var patternLetters = /[öäüÖÄÜáàâéèêúùûóòôÁÀÂÃÉÈÊÚÙÛÓÒÔÐß]/g;
                    var patternDateDmy = /^(?:\D+)?(\d{1,2})\.(\d{1,2})\.(\d{2,4})$/;
                     var lookupLetters = {
                     "ä": "a", "ö": "o", "ü": "u",
                     "Ä": "A", "Ö": "O", "Ü": "U",
                     "á": "a", "à": "a", "â": "a",
                     "é": "e", "è": "e", "ê": "e",
                     "ú": "u", "ù": "u", "û": "u",
                     "ó": "o", "ò": "o", "ô": "o",
                     "Á": "A", "À": "A", "Â": "A",
                     "É": "E", "È": "E", "Ê": "E",
                     "Ú": "U", "Ù": "U", "Û": "U",
                     "Ó": "O", "Ò": "O", "Ô": "O",
                     "ß": "s", "Ã" : "Á", "Ð" : "D"
                     };
                    var letterTranslator = function (match) {
                        return lookupLetters[match] || match;
                    }

                    return function (node) {
                        var text = $.trim($(node).text());
                        var date = text.match(patternDateDmy);
                        if (date)
                            return [date[3], date[2], date[1]].join("-");
                        else
                            //return text.replace(patternLetters);
                        return text.replace(patternLetters, letterTranslator);
                    }
                })();
            }

            $("#myTable").tablesorter({

                // initialize zebra striping and filter widgets
                widgets: ["filter", "zebra"],

                headers: {8: {sorter: false, filter: false}},

                widgetOptions: {

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

                    // 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,

                    // 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,

                    // Set this option to false to make the searches case sensitive
                    filter_ignoreCase: true,

                    // 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,
                    dateFormat: 'uk',

                    // See the filter widget advanced demo on how to use these special functions
                    filter_functions: {}

                },

                sortList: [[1, 1]],
                textExtraction: getTextExtractor()
            });

            <?php if ($anchor) {
            echo "$(document.body).scrollTop($('a[name=entry_$anchor]').offset().top-100);";
        }?>

        }
    );
</script>

0 个答案:

没有答案