Ser du noget at forbedre? Foreslå en ændring.
Motivation
In some instances you only want to add to the end of a list or delete from the end of a list. This program demonstrates how you can use the last() function to do this.
Screen Image
When you insert a new row, it will always be inserted at the end of the list. When you delete a row, it will also be removed from the end of the list.
Link to XForms Application
Sample Program
Repeat Demo
1
2
3
Value:
Insert new row
Delete last row
Discussion
Notice that the xf:insert uses the xf:action element to trigger on the DOM activate and the xf:delete uses the ev:event attribute to trigger the delete. This is because we need to include the xf:setvalue in the insert.
So, as a general rule, if you just need to use a single element in a trigger, you can use the ev:event attribute. But if you need to include several elements that all must be triggered you should wrap them in an an xf:action element.
Potential problem: when you have deleted all the nodes, the insert trigger does not work anymore. This is because the nodeset selection on the insert element is empty in that situation. If the nodeset selector is empty, the insert trigger has no meaning (see the first rule in 'rules for insert processing')
Where this page came from
This page was imported from Wikibooks. From “XForms” on Wikibooks, by its contributors, under CC BY-SA 4.0. Changed here: set as a page; navigation and edit links left out; each image under its own licence, credited in its caption.
Nobody has written it yet — it is the source material at a new address, which is why search engines are asked to skip it and why no one earns from it. It is up for grabs: take it on, and it is yours to rewrite and to earn from.
I disse publikationerXForms
Licens: CC BY-SA 4.0 · Bearbejdet efter en.wikibooks.org
1
0
0
0

Kommentarer






