Hub Nexus
작가아직 작성자가 없습니다맡기

개선할 점이 보이나요? 변경을 제안하세요.

후원

매거진 XForms · 137개 중 99번째 페이지

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.

Insert and delete from list

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.

이 페이지가 속한 매거진XForms

언어English

이용 허락: CC BY-SA 4.0 · 출처 en.wikibooks.org

1

0

0

0

Spinner Logo

코멘트

Spinner Logo
버전: 2CC0 1.0 — public domain
The runaway star that left the Tarantula Nebula
버전: 2CC0 1.0 — public domain
The Blackwell School, where segregation had no law behind it
버전: 2CC0 1.0 — public domain
The Eagle Nebula, seen in the infrared
버전: 2CC0 1.0 — public domain
The house where the Equal Rights Amendment was written
버전: 2CC0 1.0 — public domain
The Aleutians, the forgotten front of the Second World War
버전: 2CC0 1.0 — public domain
The Cosmic Cliffs are not cliffs