yadcf接口更改为exFilterColumn混淆 [英] yadcf interface change to exFilterColumn confusion

查看:93
本文介绍了yadcf接口更改为exFilterColumn混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将网站上的yadcf版本从0.6.9升级到0.8.8. (我还将从数据表1.9.4升级到1.10.10)

I am upgrading the yadcf version on my site from 0.6.9 to 0.8.8. (I'm also upgrading from datatables 1.9.4 to 1.10.10)

请参见我的沙箱网站

See the 0.6.9 version at my production site and the 0.8.8 version at my sandbox site

我已将对yadcf.exFilterColumn的呼叫从两个呼叫更新为一个呼叫,因为现在默认值采用成对的数组.

I have updated my calls to yadcf.exFilterColumn from two calls to a single call because now the defaults take an array of pairs.

但是页面加载后我的过滤数据集为空,我需要选择一个性别,然后为所有数据单击全部以显示.

But my filtered dataset is empty when the page loads, and I need to select a gender then click all for all the data to show up.

我敢肯定,对于新界面来说,这不是我想要的.

I'm sure it's something I'm not quite getting for the new interface.

更新:简化的沙箱版本此处.参见文件TestStandings.js

Update: Simplified sandbox version here. See file TestStandings.js

更新2: Daniel指出,性别过滤器的"-1"无效.显然,出于某些原因,usegender ="-1"在0.8.8中的行为与在0.6.9中的行为不同.我可以尝试弄清楚为什么它曾经起作用,但这似乎毫无用处.

Update 2: Daniel pointed out that "-1" for gender filter won't work. Apparently usegender = "-1" doesn't behave the same way in 0.8.8 as it did in 0.6.9 for some reason. I could try to figure out why it used to work, but that seems unproductive.

我在exFilterColumn调用之后添加了以下代码(在某些用例中必须过滤性别)

I added the following code after the exFilterColumn call (it's necessary for the gender to be filtered in some use cases)

    // reset gender column if didn't mean to filter
    if (usegender == "-1") {
        yadcf.exResetFilters( _rrwebapp_table, [genderCol] )
    }

但这会在jquery.dataTable.yadcf.js的第3624行出现异常,因为settingsDt.aanFeatures.f未定义

but this gets exception at line 3624 of jquery.dataTable.yadcf.js because settingsDt.aanFeatures.f is undefined

更新3:在调试数据表​​时,我将sDom从'<"H" Clpr> t'更改为默认的'lfrtip'.上面提到的异常消失了,表已正确加载.

Update 3: while debugging on the datatables side, I changed sDom from '<"H"Clpr>t' to the default 'lfrtip'. The exception mentioned above went away and the table loaded properly.

推荐答案

这是应对情况的方法

请求过滤-1值是错误的,因为表中没有这样的值,因此要在调用exFilterColumn之前重设特定的列,应使用

Its wrong to ask for filtering for a -1 value because there is no such value in the table, so in order to reset a specific column just before calling exFilterColumn you should use the exResetFilters with noRedraw set to true (grab from 0.8.9.beta.31) you should call this function before your exFilterColumn

旧答案

我可能已经注意到同一张表多次调用exFilterColumn,而实际上您应该只调用一次,只需为表的每一列设置所需的值,

I might have noticed multiple calls to the exFilterColumn for the same table, while in fact you should call it only once, just set the desired values for each column of the table,

请参阅展示页面(第一个表格)

并注意下面的相关代码

yadcf.exFilterColumn(firstTable, [
    [1, {
        from: 1,
        to: 40
    }],
    [3, "a_value"]
]);

如果仍然没有好处,请提供您的表/yadcf初始化代码以及用于调用exFilterColumn

If it still no goodm please provide the your table / yadcf init code and the code for calling the exFilterColumn

更新:

我注意到您正在使用以下代码行

I noticed that your are using the following line of code

yadcf.exFilterColumn(_rrwebapp_table, [[divisionCol, usedivision], [genderCol, usegender]])

usegender设置为"-1"的情况下,这没有任何意义,因为它是 Select input reset option(选择输入重置选项)的值,因此请确保不要在您的计算机中使用"-1"作为值exFilterColumn通话...

Where your usegender is set to "-1" which makes no sense, because its the value of the Select input reset option, so make sure you dont use "-1" as values in your exFilterColumn calls...

这篇关于yadcf接口更改为exFilterColumn混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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