也可以在可编辑控件上执行计算功能
我正在使用特定节点的计算属性,该节点可编辑以最初获取默认值。当控件最初加载时,将根据该特定节点的计算属性填充默认值。但是当我覆盖默认值时,覆盖的值不会绑定到该节点。这个问题有什么解决办法吗?
I am using the calculate attribute for a particular node which is editable to get a default value initially. When the control loads initially the default value is getting populated depending upon the calculate attribute for that particular node. But when i override the default value, the overridden value is not getting binded to that node. Is there any solution for this problem ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以允许用户编辑您已计算的节点的值。为此,在
xforms:bind
中,显式添加readonly="false()"
,作为自动指定calculate
的节点变为只读。如果您这样做,请记住,calculate
也会在用户编辑字段后运行,因此需要以不会覆盖用户输入的值的方式编写表达式。通常,您会执行类似以下操作:calculate="if (. = '') then {some expression} else ."
,如果用户确实键入了某些内容,则不会覆盖用户键入的内容。Yes, you can allow users to edit the value of a node for which you have a calculate. For this, in the
xforms:bind
, explicitly addreadonly="false()"
, as a node for which you specify acalculate
automatically becomes readonly. If you do this, keep in mind that thecalculate
also runs after users edited the field, so that expression needs to be written in such a way that it doesn't overwrite the value entered by users. Often you would do something like:calculate="if (. = '') then {some expression} else ."
, not to overwrite what users typed if they did type something.