Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何获取表格的激活状态 #113

Closed
maxmeng93 opened this issue Jul 3, 2019 · 6 comments
Closed

如何获取表格的激活状态 #113

maxmeng93 opened this issue Jul 3, 2019 · 6 comments
Labels
fix has been fix need help Extra attention is needed realized This function has been implemented

Comments

@maxmeng93
Copy link
Contributor

描述 Describe
原来编辑表格时,我会设置一个 editIndex,点击新增按钮时,检查editIndex,如果有值,则先验证正在编辑的行,验证通过,则保存数据,然后再新增一可编辑行。
现在我想知道应该用什么方法来获取处于激活状态的列。没有找到类似 getActiveRow 的方法

请提供能重现问题的链接(jsfiddlecodepenjsrun) Expected behavior

请填写以下版本信息 please complete the following information

  • browser: ?
  • vue: ?
  • vxe-table: ?
@maxmeng93 maxmeng93 added the need help Extra attention is needed label Jul 3, 2019
@xuliangzhan
Copy link
Collaborator

已增加 getActiveRow 函数

@xuliangzhan xuliangzhan added enhancement 功能需求 realized This function has been implemented labels Jul 3, 2019
@maxmeng93
Copy link
Contributor Author

maxmeng93 commented Jul 4, 2019

这个函数有问题,请看GIF演示。
每次点新增时,会调用此方法。

  1. 第一次点新增时,因为没有正在编辑的行,因此返回空对象,这没有问题。
  2. 然后点击查询,重新请求接口,重新设置 vxe-grid 的data。(这一步有时候会出现问题,点击查询后正在编辑的行不消失,后来又试了几次,没有重现)
  3. 然后再点击新增,这时候是没有正在编辑的行的,但是调用此方法返回的数据显示有。
    image

@xuliangzhan
Copy link
Collaborator

建议更新到最新试下,更新 data 并不代表表格会清除相关的状态,某些场景下你可以通过手动清除解决

@maxmeng93
Copy link
Contributor Author

还有问题,这次的问题是即便有激活的列,返回一直是null。

@maxmeng93
Copy link
Contributor Author

maxmeng93 commented Jul 5, 2019

const active = table.getActiveRow();
console.log(active);

一直打印 null
还有就是我一共点了三次查询。
第一次点击时,新增的空行都没有了。
第二次点击时,没有数据的那行还在。
第三次点击,正常。
image

@maxmeng93
Copy link
Contributor Author

@xuliangzhan xuliangzhan added the fix has been fix label Jul 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix has been fix need help Extra attention is needed realized This function has been implemented
Projects
None yet
Development

No branches or pull requests

2 participants