Menu:

Recent Entries

Categories

Archives

Links

Blogs
- Dflying's Night
- David's Untitled Life
- Dflying's Blog in Chinese

This blog is hosted by DreamHost!

Syndicate

RSS 0.90
RSS 1.0
RSS 2.0
Atom 0.3

Introduction to Atlas Controls in Namespace Sys.Data – DataColumn, DataRow and DataTable

Dflying | 14 April, 2006 20:39

In this post we are going to touch the key client side data components of Atlas – the DataTable, which is used to represent a tabular data structure. The DataTable object connects the actual data – the DataSource and the UI control – the ListView. It is the data field of a DataSource object, and can also be decorated by a DataView object by filtering and sorting the rows or doing the page navigations. Here Atlas also shares the ASP.NET/ADO.NET concepts: the Atlas DataSource is similar with ADO.NET SqlDataSource, the Atlas DataTable is similar with ADO.NET DataTable and the Atlas ListView is similar with ASP.NET ListView. Pretty easy to understand, isn't it? A DataTable contains a collection of DataColumn objects and a collection of DataRow objects, so let's begin with the DataColumn and DataRow.


Sys.Data.DataColumn

The DataColumn object is really simple, only following properties:

  1. columnName: Column name string.
  2. dataType: The type of data in this column.
  3. defaultValue: The default value in this column.
  4. isKey: Whether data in this column is the key of DataTable.
  5. readOnly: Whether data in this column is read only.

Sys.Data.DataRow

Sys.Data.DataRow object is a little bit of complex, there’s following properties:

  1. $isDirty: Whether this row is modified and not submitted to server yet.
  2. $index: The index of current row in DataTable.
  3. $selected: Whether this row is selected.

And following event:

  1. propertyChanged: gets fired when one of the above properties is changed.

Sys.Data.DataTable

Now let start the DataTable, the DataTable object implements the Sys.Data.IData interface. Following properties:

  1. columns: Current collection of DataColumn objects. You may add/update/delete a column when get the collection.
  2. keyNames: The collection of key columns’ columnName property.
  3. length: Length of row collection.
  4. isDirty: Whether the DataRow collection is changed and not submitted to server yet.

And following methods:

  1. add: Add a new row to current DataTable.
  2. clear: Delete all rows in current DataTable.
  3. remove: Remove an existing row in current DataTable.
  4. createRow: Create a new row based on current DataTable’s schema.
  5. getChanges: Get the changes of current DataTable. There are three parts in the result.
    1. updated: The updated row collection.
    2. inserted: The added row collection.
    3. deleted: The delete row collection.
  6. getColumn: Get a DataColumn object by column name.
  7. getRow: Get a DataRow object by row index.
  8. getItem: The same to getRow method.

Also events:

  1. collectionChanged: Gets fired when the DataRow collection is modified.
  2. propertyChanged: Gets fired when one of the properties above is changes.

Demos about using DataTable object please refer to: http://dflying.dflying.net/1/archive/81_introduction_to_atlas_datatable.html

Posted in Atlas. Comment: (0). Trackbacks:(18). Permalink
«Next post | Previous post»

Referers

Comments

Leave a Reply

Auth Image