Element: [Bug Report] filter-change does not automatically update filtered-value

Created on 29 Jun 2017  ·  10Comments  ·  Source: ElemeFE/element

Element UI version

1.3.7

OS/Browsers version

macOS 10.12.4/Chrome 59.0.3071.109

Vue version

2.3.4

Reproduction Link

https://jsfiddle.net/e11274bn/2/

Steps to reproduce

1.默认使用filtered-value选中公司这个标签
2.点击清空,筛选标签正常渲染
3.点击选中家按钮,筛选标签正常渲染
4.点击筛选中的家,公司,然后点击筛选,filtered-value没有更新,并且再手动更新filter-value无效

What is Expected?

filtered-value应该在filter-change时,实时更新,并且可以用filter-value控制筛选选项的选中状态

What is actually happening?

filtered-value在点击筛选之后就无法实现数据双向绑定

table stale

Most helpful comment

设置el-tablerefa 那么可以这样拿到filtered-value
let columns = this.$refs.a.columns
filteredValue = columns[0].filteredValue
filteredValue1 = columns[1].filteredValue
以此类推 ...
@ttchin @zhouwenbin @athena0304 @frankyeyq

All 10 comments

Translation of this issue:

Element UI version

1.3.7

OS/Browsers version

MacOS 10.12.4/Chrome 59.0.3071.109

Vue version

2.3.4

Reproduction Link

https://jsfiddle.net/e11274bn/2/

Steps to reproduce

  1. defaults to using filtered-value to select the label of the company

  2. click "empty", filter labels, render normally

  3. click the checked home button to filter the labels for normal rendering

  4. click on the home in the filter, the company, and then click filter, filtered-value does not update, and then manually update the filter-value invalid

    What is Expected?

Filtered-value should be updated in real time at filter-change and can be used to control the selected state of the filter option with filter-value

What is actually happening?

Filtered-value cannot achieve two-way binding of data after you click filter

i got same issue...

我也遇到了相同的问题,filtered-value根本不生效啊
https://jsfiddle.net/athena0304/xcydoxfr/
filteredValue一直是空的

数据如果是异步的,filtered-value不能过滤数据

也就是说filtered-value只能一开始就设定好,不能在页面渲染后更新?

设置el-tablerefa 那么可以这样拿到filtered-value
let columns = this.$refs.a.columns
filteredValue = columns[0].filteredValue
filteredValue1 = columns[1].filteredValue
以此类推 ...
@ttchin @zhouwenbin @athena0304 @frankyeyq

@zhouwenbin @ttchin 如果数据是异步的,filtered-value 的问题能解决么?

@zhouwenbin 解决了吗? 我现在是首次设置filtered-value 后,想利用其提供清空筛选clearFilter的方式时,无法清除filtered-value ,但是我绑定的值已经空了

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

还是不行啊…即使按照 @Draco-china 的方法都没用,我在filter-method里加了两行输出:

filterMethod: function(value, row, colomn) {
            console.log(value);
            console.log(this.$refs.myTable.columns[2].filteredValue);
            return value == row.emotion;
}

然后发现当我用代码去修改filteredValue之后,输出了不属于filteredValue的value。
但是如果我手动点击“筛选”,输出的value和filteredValue都是正常的。
也就是说用代码修改filterValue之后,虽然这个值改了,它实际筛选用的却不是这个列表。这是为什么啊?我想知道“筛选”操作到底做了什么?如何用代码执行这个“筛选”操作?

Was this page helpful?
0 / 5 - 0 ratings