A & B Computers
Computer Retailer
O
0
Consumer Marketing
Advertising Agency
O
1
Steve Taylor
Jedi Knight
I
1
Big B Drugs
Pharmacy
O
1
<new customer>
<new description>
I
1
Adding/Removing Records from a Data Island Bound Table
by Chris Curry
REQUIRES: IE 5.0 +
Download source
The following article is a sequel to Chris's previous article: XML data
binding with data types
Here are a couple simple examples of how to add and remove records in a table that is bound to a XML data island.
All examples use the XMLDocument property of the corresponding XML data island.
XMLDocument returns the DOM document object (DOMDocument) used by the data island and gives you full access to all properties and methods
of the DOM. The data binding behavior of most elements are very responsive to changes made with the DOM so most changes you make to a data island using the DOM document will be reflected in any bound elements. Being
familiar with the DOM's properties and methods will not only make client side XML
development much easier but also DHTML development as well.
The example below shows two methods for adding records and a delete method to a table that is bound to a data island.
All these methods make changes to the XML data island and the
bound table automatically updates itself. This
demonstrates the usefulness of using a dataisland to manipulate data.
The one method, 'Add Last Record', simply takes the last record entry of the table and uses it to add a new record.
The other method, 'Add Prebuilt Record', uses a second data island which already has
the data of an XML row prebuilt and uses it as a bases for adding a new record to the table.
The benefit of the second method is that it allows you to maintain default values (as well as any attributes or additional elements that are not displayed in the table) for a record without having to add defaults manually in script.
As you click on the command buttons below, the 'JavaScript' or 'VBScript' source
for the command is displayed.
As the data in the table changes, it updates it this XML dataisland, below.
Click on the command buttons for the demonstation:
Chris Curry is
a senior developer for the Grizzard Agency of MSGI
direct. Using VB COM, XML, XSL, DHTML, JavaScript, ASP and whatever he can
get his grimy hands on. He specializes in building client/server, systems
integration, and management information systems.
chris.curry@grizzard.com
Grizzard Advertising
A subsidiary of MSGI Direct.
|