久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何將過(guò)濾器應(yīng)用于特定的數(shù)據(jù)表

How to apply filter to specific datatable(如何將過(guò)濾器應(yīng)用于特定的數(shù)據(jù)表)
本文介紹了如何將過(guò)濾器應(yīng)用于特定的數(shù)據(jù)表的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

是否可以僅對(duì)一個(gè)數(shù)據(jù)表應(yīng)用某個(gè)過(guò)濾器?我在準(zhǔn)備好文檔時(shí)應(yīng)用了以下過(guò)濾器功能,我不知道這是否是正確的程序,但作為副作用,所有數(shù)據(jù)表都會(huì)受到過(guò)濾器的影響.我只想影響 $('#productTable'),但這個(gè)選擇器似乎沒(méi)有預(yù)期的效果.

Is it possible to apply a certain filter to only one datatable? I have the following filter function that I am applying on document ready, I don't know if this is proper procedure, but as a side effect all dataTables will be affected by the filter. I would Like to affect only the $('#productTable'), but this selector appears to not have the desired effect.

//Filter Function in Stock 
//$('#productTable').
$.fn.dataTableExt.afnFiltering.push(function(oSettings, aData, iDataIndex) {
    var checked = $('#instock').is(':checked');
    var qntStock = 1; 
    var stockCol = 3; 

    if (!checked) {
        return true;
    }
    if (checked && aData[stockCol] > qntStock) {
        return true;
    }

    return false;
 });

是否可以僅對(duì)特定表應(yīng)用過(guò)濾器?我該如何做到這一點(diǎn)?

Is it possible to apply a filter only to a particular table? How do I accomplish this?

數(shù)據(jù)表初始化:

var oTable = $('#productTable').dataTable({
        "aoColumnDefs": [{
            "sClass": "my_class", 
            "aTargets": [4]
            }],
        "bAutoWidth": false,
        "iDisplayLength": 100,
        "fnDrawCallback": function() {
            $("td.my_class").editable(function(value, settings) 
            { 
                return(value);
            }, 
            {
                indicator : 'Save...',
                tooltip   : 'Click to Edit...'
            }
            );
        }
    });

推薦答案

您可以創(chuàng)建一個(gè)表數(shù)組來(lái)進(jìn)行過(guò)濾 - 然后在您的過(guò)濾器中檢查當(dāng)前表是否存在于該數(shù)組中......類似于:

You could create an array of tables to have the filter - then in your filter check if the current table is present in that array ... something like :

// setup an array of the ids of tables that should be allowed
var allowFilter = ['productTable'];

$.fn.dataTableExt.afnFiltering.push(function(oSettings, aData, iDataIndex) {

    // check if current table is part of the allow list
    if ( $.inArray( oSettings.nTable.getAttribute('id'), allowFilter ) == -1 )
    {
       // if not table should be ignored
       return true;
    }
    var checked = $('#instock').is(':checked');
    var qntStock = 1; 
    var stockCol = 3; 

    if (!checked) {
        return true;
    }
    if (checked && aData[stockCol] > qntStock) {
        return true;
    }

    return false;
});

這篇關(guān)于如何將過(guò)濾器應(yīng)用于特定的數(shù)據(jù)表的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

jQuery/JavaScript Library for avatar creation?(用于創(chuàng)建頭像的 jQuery/JavaScript 庫(kù)?)
How to do following mask input problem?(如何做以下掩碼輸入問(wèn)題?)
Issues Setting Value/Label Using DropKick Javascript(使用 DropKick Javascript 設(shè)置值/標(biāo)簽的問(wèn)題)
how to unit-test private methods in jquery plugins?(如何對(duì) jquery 插件中的私有方法進(jìn)行單元測(cè)試?)
stellar.js - configuring offsets / aligning elements for a vertical scrolling website?(stellar.js - 為垂直滾動(dòng)網(wǎng)站配置偏移量/對(duì)齊元素?)
jQuery masked input plugin. select all content when textbox receives focus(jQuery 屏蔽輸入插件.當(dāng)文本框獲得焦點(diǎn)時(shí)選擇所有內(nèi)容)
主站蜘蛛池模板: 欧美xxxx网站| 日本天堂在线 | 69福利视频 | 免费三级黄色片 | 天天干夜夜爽 | 草草在线视频 | 黄色片免费在线观看 | 日韩视频在线免费观看 | 91青青草| 亚洲午夜久久 | 噜噜噜在线| 国产精品毛片av | av不卡一区| 这里都是精品 | 在线视频99| 在线观看网址你懂的 | 久久艳片www.17c.com | 在线综合网 | 精品免费在线观看 | 伊人久久影视 | 午夜爽爽影院 | 一级性生活视频 | 日韩一区二区三区精品 | 人与拘一级a毛片 | 黄色片视频 | 在线播放中文字幕 | 免费成人深夜夜国外 | 特大黑人巨交吊性xxxx视频 | 日韩精品视频免费在线观看 | 爱福利视频 | 五月激情综合网 | av手机在线看| a毛片在线观看 | 日韩精品一区在线观看 | 精品国产乱码久久久久 | 国产精品美女久久 | 亚洲精品久久久久久久久 | 欧美片网站yy | 日韩av资源 | 国产又粗又大又长 | 性史性dvd影片农村毛片 |