无法让我的数据表显示工作正常

时间:2013-09-10 18:54:42

标签: javascript jquery jquery-datatables

这可能只需要另一双眼睛,因为我遗漏了一些简单的东西。一切都在运作,我想我在某个地方做了一些简单的事情。

$(document).ready(function () {

$('#dblist').on('change', function () {

    var selected = $("select option:selected").text();
    tablefill(selected);

});

$('#search').click(function () {

    var selected = $("select option:selected").text();
    tablefill(selected);

});

function tablefill(selected) {
    $('#sbar').show();

    $('#table_id').dataTable({
        "sAjaxSource": '/php/connect/searchtablequery.php',
        "bProcessing": true,
        "sScrollY": "500px",
        "bDeferRender": true,
        "bDestroy": true,
        "sAjaxDataProp": "",
        "fnServerParams": function (aoData) {
            aoData.push({ "name": "db", "value": selected });
        },
        "aoColumnDefs": [
            { "bVisible": false, "aTargets": [1] }
        ],
        "aoColumns": [
            { "mData": "calldate" },
            { "mData": "recordingfile" },
            { "mData": "uniqueid" },
            { "mData": "src" },
            { "mData": "did" },
            { "mData": "lastapp" },
            { "mData": "dst" },
            { "mData": "disposition" },
            { "mData": "duration" },
            { "mData": "userfield" },
            { "mData": "accountcode"}],
        "iDisplayLength": 20,
        "bJQueryUI": true,
        "sPaginationType": "full_numbers",
        "sDom": '<"H"Tfr>t<"F"ip>',
        "oTableTools": {
            "sSwfPath": "/DataTables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
            "aButtons": [
                "copy", "csv", "xls", "pdf",
                {
                    "sExtends": "collection",
                    "sButtonText": "Save",
                    "aButtons": ["csv", "xls", "pdf"]
                }
            ]
        }
    });
}

});

如果您看到任何改进或无用的代码,请告诉我,我一直在寻求学习。

0 个答案:

没有答案