Hub Nexus
著者著者はまだいません引き受ける

改善できるところがありますか?変更を提案しましょう。

支援

This lab allows you to insert a new row into a tabular structure. We don't use a HTML table here, just a form that updates two items in the model.

Here is the input before you add any new data:

Program Code

xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">;

XForms insert example

xmlns="">

Peggy
123

Dan
456

John
789

Sue
234

/>
/>

Company Phone List

Name, Phone
id="list" nodeset="/PhoneList/Person">
ref="Name" />
ref="Phone" />

Add New Person

ref="/PhoneList/NewPerson/Name">
Name:

/>
ref="/PhoneList/NewPerson/Phone">
Phone:

Insert After Selected Row
ev:event="DOMActivate">
nodeset="/PhoneList/Person" at="index('list')" position="after" />
ref="/PhoneList/Person[index('list')]/Name" value="/PhoneList/NewPerson/Name" />
ref="/PhoneList/Person[index('list')]/Phone" value="/PhoneList/NewPerson/Phone" />

Discussion

This program has a model of the existing phone list and one additional NewPerson data element at the end of the list. The new person data is linked to the two field form at the end of the table. When you hit the insert button (the trigger) it will copy the data elements from the mini-form and copy them into a new location inside the existing model. The entire list will then be updated. The exact location of where the insert occurs is determined by the index() function. The index is the number of the row you last selected.

There are two items to note. First of all, you can select any row just before you do an insert. The new item will be inserted just after this row.

The second thing to note is that you will still need to be able to delete a record. That is the next lab.

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