gpt4 book ai didi

datatables - yadcf 过滤器在列内带有选择标签

转载 作者:行者123 更新时间:2023-12-03 09:46:11 26 4
gpt4 key购买 nike

我有一个包含在列标记中的表(使用数据表框架)。我的意思是该列的内容如下所示:

<td>
<select class="form-control attendance_select" data-id_player="130">
<option value="-1">No</option>
<option value="0" selected="">No answer</option>
<option value="1">Yes</option>
</select>
</td>

当我使用 yadcf 列过滤器并尝试在此选择中仅搜索"is"作为选定选项的列时,它不起作用,因为每行在 html 代码中都包含"is"。

你能帮我吗,如果可能的话,如何设置 yadcf 来解决这个问题?

谢谢

最佳答案

您可能需要定义过滤器类型“custom_func”并为您的列指定自定义过滤器函数。

来自 inline docs: (重新格式化的解释)

custom_func

Required: true, when filter_type is custom_func
Type: function
Default value: undefined
Description: should be pointing to a function with the following signature


function myCustomFilterFunction(filterVal, columnVal, rowValues, stateVal) {

}

where filterVal: is the value from the select box,
columnVal is the value from the relevant row column,
rowValues is an array that holds the values of the entire row and
stateVal which holds the current state of the table row DOM
, stateVal is perfect to handle situations in which you placing radiobuttons / checkbox inside table column (should be suitable for your case of select.

This function should return true if the row matches your condition and the row should be displayed) and false otherwise.

关于datatables - yadcf 过滤器在列内带有选择标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41383746/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com