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

首次打开一对多表单,JEditableTable的addDefaultRowNum属性不生效 #1003

Closed
553036892 opened this issue Mar 11, 2020 · 8 comments

Comments

@553036892
Copy link

版本号:2.1.4
问题描述:JEditableTable监听datasource属性中兼容ie的代码,会导致首次打开一对多表单会导致addDefaultRowNum属性添加的空行被删除。浏览器是chrome
截图&代码:
 dataSource: {
    immediate: true,
    handler: function (newValue) {
      if(newValue.length == 0){//不执行下面代码就没问题
        return
      }
      // 兼容IE
      this.getElementPromise('tbody').then(() => {

        this.initialize()

        省略。。。

友情提示: 未按格式要求发帖,会直接删掉。

@zhangdaiscott
Copy link
Member

好的,我们确认下

@bill74s
Copy link

bill74s commented Mar 12, 2020

是否和那个删除的问题一样啊

@553036892
Copy link
Author

打断点看是空行已经添加了,然后又没了,就把这过程叫做删除了。

@sjlei
Copy link

sjlei commented Mar 13, 2020

确实是因为预添加的行又被删了

由于this.getElementPromise 方法是异步的,所以有可能导致预添加的行在该方法之前运行

image

而在 then 方法里又会清空 rows ,也就是删除所有行

image

我加了个判断就好了

image

该功能下个版本发布后修复,在此之前可以按照上图的代码修改

@sjlei
Copy link

sjlei commented Mar 13, 2020

image

@553036892
Copy link
Author

还有个问题,首次打开,JEditableTable下拉框选项,没有加载出来,要在随便输入框填一下,下来选项才加载出来

@sjlei
Copy link

sjlei commented Mar 14, 2020

还有个问题,首次打开,JEditableTable下拉框选项,没有加载出来,要在随便输入框填一下,下来选项才加载出来

上图的代码里确实有这个问题,我那样改之后导致存值的变量不是响应式的了,所以无法及时更新视图,改成下面这样就好了

image

@sjlei
Copy link

sjlei commented Mar 14, 2020

@553036892 你要是说 checkbox 或者 select 选不上确实有这个问题,采用我刚发的代码就能解决。但是下拉选项没有加载出来这个问题倒是没有复现

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants