[
https://issues.apache.org/jira/browse/XAP-270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12495117
]
Michael Mikhaylov commented on XAP-270:
---------------------------------------
I don't think it is possible to have duplicate ID in XAL document. But, in this
case, there is an easy workaround:
<xal xmlns="http://openxal.org/ui" xmlns:macro="http://openxal.org/core/macro"
xmlns:xm="http://openxal.org/core/xmodify">
<rootPane>
<verticalBoxPane>
<button id="testComponent" text="bar"
onCommand="macro:resetButton.execute('testComponent')"/>
</verticalBoxPane>
</rootPane>
<macro:macro id="resetButton">
<xm:modifications>
<xm:replace select="id('{0}')">
<button id="{0}" text="foo"/>
</xm:replace>
</xm:modifications>
</macro:macro>
</xal>
> Xmodify: Elements in xModify can't have same ID as elements in UI document
> --------------------------------------------------------------------------
>
> Key: XAP-270
> URL: https://issues.apache.org/jira/browse/XAP-270
> Project: XAP
> Issue Type: Bug
> Components: XModify
> Reporter: Trevor Oldak
>
> If an element in a document is being replaced, the ID for the original object
> cannot be preserved. The macro below would throw an error because the button
> replacing testComponent has the same id. We cannot set the id of an element
> after it has been created. Therefore, there is no way to 'reset' an element
> through a macro, without removing every possible attribute.
> <macro:macro id="resetButton"
> xmlns:macro="http://openxal.org/core/macro">
> <xm:modifications xmlns:xm="http://openxal.org/core/xmodify">
> <xm:replace select="id('testComponent')">
> <button id="testComponent" text="foo"/>
> </xm:replace>
> </xm:modifications>
> </macro:macro>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.