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 – DataView and DataFilter

Dflying | 15 April, 2006 20:54

This is the third, also the last part of introductions to Sys.Data controls. In my previous posts, we know how to get data from server side and store in client side by using DataSource controls and how to modify the data we get on client side by using DataTable object. We can display the data in the DataTable right now to user but in most cases we need to do some decorations before showing, for example, we may need to page our data if it contains thousands of rows, or our user may be only interested in some of the data such as Dflying’s data. That’s the reason why we have to introduce the DataView and DataFilter objects. Now let’s see how to decorate our data for UI controls by using DataView object and DataFilter object.


Here are the properties of DataView object:

  1. data: The actual data for decorating. You should always set a DataTable get from DataSource control to this property to let the DataView know the source data.
  2. filteredData: The filtered data. Such as the paged data or the sorted data.
  3. filters: A collection of DataFilter objects to filter the data. You can specify the DataView a collection of filters and they will be applied to your data one by one. For more information about DataFilter object, please see below.
  4. hasNextPage: Whether there’s a next page.
  5. hasPreviousPage: Whether there’s a previous page.
  6. length: How many rows in current page.
  7. pageCount: How many pages in current DataView.
  8. pageIndex: Current page index.
  9. pageSize: How many rows per page. You should set this property if you need to page your data.
  10. sortColumn: The column you want to sort the rows by. You should set this property if you need the sort feature.
  11. sortDirection: The directions you want to sort. Either Ascending (default value) or Descending.

And DataView object has one method:

  1. sort: Apply the sort operation according to sortColumn property and sortDirection property.

Remember you may need two additional controls in Sys.Data.UI namespace: DataNavigator and SortBehavior to help you with the paging and sorting issues. And for introductions and demos for DataView and these two controls, please be a little patient on my future posts.

Ok for the DataView object, let’s see the DataFilter object:

The Sys.Data.DataFilter class in Atlas is designed as the abstract base class of all the filters. It provides an abstract method filter for the derived class to implement its specified filter rules.

Atlas provides one build-in filter – the PropertyFilter, which is used for filtering the items by one specified property and its value.

PropertyFilter object has two peoperties:

  1. property: The property you want to apply the filter to.
  2. value: The value whose specified property equals to will pass this filter.

Demos for DataFilter object is coming soon.

At the end of this series let’s have a summary about the three parts of Atlas controls in namespace Sys.Data. Keep these in your mind will help a lot in future developing.

  1. DataSource and XMLDataSource are used for getting data from server and store is on the client side.
  2. DataTable, including DataRow and DataColumn, is the actual storage of client side data and you may modify the data as you with on the client side.
  3. DataView and DataFilter are used for decorating your data before displaying to user. These operations do not change the actually data but behave just like the SQL syntax where and order by.

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

Referers

Comments

Leave a Reply

Auth Image