Work
with Table Binding
Using table data binding, you can display multiple records in a recordset:
<table datasrc="#id">
<tr>
<td><span datafld="field1"></span></td>
<td><span datafld="field2"></span></td>
</tr>
</table>
Note that the <td> tag doesn't support data binding, so you
must use a tag that does, such as the <span> tag. The browser
will automatically add as many rows as it needs to display all the records
in the recordset. It is often desirable, however, especially if your
table gets quite large, to specify how many records display at once.
This is called paging. You specify your paging in the <table>
tag as follows:
dataPageSize="number"
To create a command that allows you to navigate through a table page,
you must first assign a unique id to the table. Once you assign an id
to the table, you can reference the table id using table methods and
properties. The following methods and properties are applicable to table
data navigation.
id.firstPage()
id.previousPage()
id.nextPage()
id.lastPage()
id.dataPageSize=n
Bind
XML Data to a Table
Open FP2text.htm, view the source code and rename the
file to FP2.htm. Edit the code as follows:
<table width="460" border="1" datasrc="#Staff_Info"
dataPageSize="3" id="StaffTable">
<img datafld="Photo">
<span class="celltext" datafld="Name"></span>
<span class="celltext" datafld="Department"></span>
<span class="celltext" datafld="Position"></span>
<span class="celltext" datafld="Phone"></span>
<span class="celltext" datafld="Years"></span>
<span class="celltext" datafld="Status"></span>
Add the table methods:
<button onClick="StaffTable.firstPage()">|< First</button>
<button onClick="StaffTable.previousPage()"><
Previous Page </button>
<button onClick="StaffTable.nextPage()">Next Page ></button>
<button onClick="StaffTable.lastPage()">Last >|</button>
Save and refresh the file. Test the navigation.