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

table里,laydate.render问题 #1532

Closed
4 tasks done
len200 opened this issue Jan 4, 2024 · 2 comments
Closed
4 tasks done

table里,laydate.render问题 #1532

len200 opened this issue Jan 4, 2024 · 2 comments
Labels
discussion 讨论性质的问题

Comments

@len200
Copy link

len200 commented Jan 4, 2024

议题条件

  • 我确认已查看官方使用文档:https://layui.dev ,但没有找到相关解决方案。
  • 我确认已在 Issues 中搜索过类似的问题,但没有找到相关解决方案。
  • 我已仔细阅读: 🍀 Layui Issue 贡献指南

议题类型

疑是 BUG

使用版本

v2.8.18

问题描述

table有一栏是date数据,用radio来控制是否可以编辑,初始页面没有checked的时候,date栏位是受控的,没有弹出laydate,当选中某一行radio的时候,对应栏位可以弹出laydate,但是之后再选中其它行的时候,之前选中过的也可以弹出,并不受radio控制,跟踪了代码走向,前面的控制都是受控的,没有走到,直接跑进laydate.render里了。

业务代码

table.on('tool(table)', function(obj) {
  if (checked_id == obj.data.oid) {
     table_on_tool(obj, that);
  }
});
table.on('radio(table)', function(obj) {
   checked_id = obj.data.oid;
});
function table_on_tool(obj, that) {
  let layEvent = obj.event;
  let data = obj.data;
  let field = $(that).data('field');
//这里加log,也没执行到
  if (layEvent === 'updateDate') {
       laydate.render({
          elem: that.firstChild,
          show: true,
          closeStop: that,
          calendar: true,
          value: data[field],
          done: function(value, date, endDate) {
//这里加log,修改日期会跑到
             data[field] = value;
             obj.update(data);
             let updateItem = field,
             updateValue = data[field];
             update_data(table, updateItem, updateValue, obj);
          }
      });
}
}

截图补充

image

浏览器

Chrome 120.0.6099.129

演示地址

No response

友好承诺

  • 我承诺将本着相互尊重、理解和友善的态度进行交流,共同维护 Layui 良好的社区氛围。
@Sight-wcg
Copy link
Collaborator

在 radio 事件中,使用 laydate.unbind(id) 解绑非选中项实例。或者给非选中项设置禁用状态。

@Sight-wcg Sight-wcg added the discussion 讨论性质的问题 label Jan 4, 2024
Copy link

github-actions bot commented Jan 4, 2024

@len200 你好,Issue 只接受「Bug 报告」和「功能请求」,而你的议题涉及到如何使用、功能疑惑或其他业务相关的问题,这并不适合作为 Issue 讨论。建议你通过以下方式寻求解决方案:

  • 仔细查阅 Layui 官方文档:https://layui.dev
  • 通过其他技术社区搜索相关资料、或充分利用当前主流的人工智能大模型
  • Discussions

详见:🍀 Layui Issue 贡献指南

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion 讨论性质的问题
Projects
None yet
Development

No branches or pull requests

2 participants