本文介绍了onclick事件不适用于multi_select过滤器-javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里阅读了 filter_type 但我不明白如何提供thiese参数

I read docs here for filter_type but I don't understand how provide thiese arguments

  • onclick事件
  • label.lightblue (或 label2.lightblue2 .. )
  • onclick event
  • label.lightblue (or label2.lightblue2..)

如果要设置yadcf.exFilterColumn

for yadcf.exFilterColumn if I want to set

filter_type: "multi_select":
select_type: 'select2'

我的代码是这样的:

 $('#example').on('click', ".label.lightblue", function () {

        yadcf.exFilterColumn(oTable, [
            [5, $(this).text()]
        ]);
  });

这是我的表格:实时演示
请看最后一栏.如果单击行表内的标签,则可以过滤行.我将filter_type从auto_complete更改为multi_select

This is my table: Live Demo
Look last column, please. If you click on a tag inside row table you can filtering rows.I change filter_type from auto_complete to multi_select

column_number: 5,
column_data_type: "html",
html_data_type: "text",
filter_default_label: "Select tag",
filter_type: "multi_select":
select_type: 'select2'

但是,如果现在单击表行中的标签,则onclick事件函数在第5列中不再起作用,请看以下示例:单次事件冻结

But if you click now on tags inside table rows onclick event functions don't work anymore for column 5, look this example: ONCLICK EVENT freezing

我尝试改变

yadcf.exFilterColumn(oTable, [[5, $(this).text()]]);

进入

yadcf.exFilterColumn(oTable, [[5, ['click','label.lightblue']]]);

但不起作用

推荐答案

我将忽略您的问题,因为我不确定为什么您最终会尝试在那里写的东西

I will ignore your question because I'm not sure why you ended up trying the stuff you wrote there

您要从表行本身触发多选择过滤器的当前方案的不同之处在于,现在需要提供一个具有单个值的数组,而不是提供clicked元素的文本,即熟悉,但是,如果您想单击行以将选择项添加到过滤器中,那么如果假设您单击Tag1,然后单击Tag2,则希望看到由Tag1和Tag2填充的过滤器您需要进行以下操作:

The difference in your current scenario in which you want to trigger multi selct filter from the table row itself is that now instead of providing the text of the clicked element you need to provide an array with a single value which is that text you are familiar with, BUT if you want to make the click on row to add selections to your filters so if suppose you click on Tag1 and then on Tag2, you expect to see the filter populated with Tag1 and Tag2 you need to make the following:

每次单击列值(Tag1/Tag2/等)时,都必须使用 yadcf.exGetColumnFilterVal(...),然后将您新单击的值添加到此数组中,然后再调用exFilterColumn函数(与刚刚构建的新数组.

Each time you click on the column value (Tag1 / Tag2 / etc, you must extract the current selected value of that column using the yadcf.exGetColumnFilterVal(...) , then add to this array your newly clicked value , and only then call the exFilterColumn function (with the new array that you just constructed.

如果您按照我的指示进行操作,就可以了

If you will follow my instruction it should work just fine

这篇关于onclick事件不适用于multi_select过滤器-javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 00:20