数据模板问题提问
流程表单页面使用数据模板组件,版本8.0.2我在数据模板中用一个checkbox来控制另一个元素的显隐状态(默认是隐藏,checkbox值为是时显示display: flex,否时隐藏display: none),测试正常,但是当我点击添加新的一条数据时,display从flex变为none了,数据没丢
代码如下:
const zhongbiao = this.target.parentLine.getModule("zhongbiaotongzhishu").getData()
const tongzhishufujian = this.target.parentLine.node.getElementById("table_2_table$Td_11")
if(zhongbiao === '是') {
tongzhishufujian.style.display = "flex"
} else {
tongzhishufujian.style.display = "none"
}
把上面的代码在新增按钮的onclick事件中写进去,也不好使
录屏如下:
添加新的一栏后,const tongzhishufujian = this.target.parentLine.node.getElementById("table_2_table$Td_11")这个id不是唯一的
所以不要用id去获取,用上下节点这种层级方式去获取 论坛管理员 发表于 2024-12-6 10:20
添加新的一栏后,const tongzhishufujian = this.target.parentLine.node.getElementById("table_2_table$T ...
还是有点不太明白,请问有例子吗? 没有现成的样例
const zhongbiao = this.target.parentLine.getModule("zhongbiaotongzhishu").node;拿到按钮所在的dom对象了,然后获取它所在的tr,再获取它的下一个tr,隐藏 论坛管理员 发表于 2024-12-6 10:30
没有现成的样例
const zhongbiao = this.target.parentLine.getModule("zhongbiaotongzhishu").node;拿到按 ...
好的,我试一下,谢谢:handshake 论坛管理员 发表于 2024-12-6 10:30
没有现成的样例
const zhongbiao = this.target.parentLine.getModule("zhongbiaotongzhishu").node;拿到按 ...
您好,我改成这种写法了,但是还是在添加项目时还是消失了,代码如下:
const zhongbiao = this.target.parentLine.getModule("zhongbiaotongzhishu").getData()
const tongzhishufujian = this.target.parentLine.getModule("zhongbiaotongzhishufujian")
console.log("tongzhishufujian === >", tongzhishufujian)
console.log(tongzhishufujian.node)
console.log(tongzhishufujian.node.parentElement)
console.log(tongzhishufujian.node.parentElement.parentElement)
if(zhongbiao === '是') {
tongzhishufujian.node.parentElement.parentElement.style.display = 'flex'
} else {
tongzhishufujian.node.parentElement.parentElement.style.display = 'none'
}
我需要在按钮的onclick里再重复一下这个操作吗? 您是否方便把这个表单导出一下附件放上来,管理员这边帮您检查一下 已添加附件 论坛管理员 发表于 2024-12-9 10:25
您是否方便把这个表单导出一下附件放上来,管理员这边帮您检查一下
好的,已经传附件了,谢谢
管理员拿您这个上传上去,测试没有问题,建议您升级一下o2server版本吧,管理员这边是在9.1.3上进行的测试
页:
[1]
2