Presenting an alternate view of the data
You can sort and filter the data in any StorageDataSet. However, there are situations where you need the data in the StorageDataSet presented using more than one sort order or filter condition simultaneously. The DataSetView component provides this capability.
The DataSetView component also allows for an additional level of indirection which provides for greater flexibility when changing the binding of your UI components. If you anticipate the need to rebind your UI components and have several of them, bind the components to a DataSetView instead of directly to the StorageDataSet. When you need to rebind, change the DataSetView component to the appropriate StorageDataSet, thereby making a single change that affects all UI components connected to the DataSetView as well.
To create a DataSetView object, and set its storageDataSet property to the StorageDataSet object that contains the data you want to view,
- Open or create the project you created for "Providing data".
- Select the Frame file in the Navigation pane. Click the Design tab.
- Add a DataSetView component from the Data Express tab to the Component tree.
- In the Inspector, set the storageDataSet property of the DataSetView component to queryDataSet1.
- The DataSetView navigates independently of its associated StorageDataSet. Add another GridControl, StatusBar, and NavigatorControl to the UI Designer. To enable the controls to navigate together, set their dataSet properties to dataSetView1.
- Compile and run the application.
The DataSetView displays the data in the QueryDataSet but does not duplicate its storage.
It presents the original unfiltered and unsorted data in the QueryDataSet.
You can set filter and sort criteria on the DataSetView component that differ from those on the original StorageDataSet. Attaching a DataSetView to a StorageDataSet and setting new filter and/or sort criteria has no effect on the filter or sort criteria of the StorageDataSet.
To set filter and/or sort criteria on a DataSetView,
- Select the Frame file in the Navigation pane. Select the Design tab.
- Select the DataSetView component.
- On the Properties page in the Inspector,
- Select the sort property to change the order records are displayed in the DataSetView. See "Sorting data" for more information on the sortDescriptor.
- Select the masterLink property to define a parent data set for this view. See "Establishing a master-detail relationship" for more information on the masterLinkDescriptor.
- On the Events page in the Inspector,
- Select the filterRow method to temporarily hide rows in the DataSetView. See "Filtering data" for more information on filtering.
You can edit, delete, and insert data in the DataSetView by default. When you edit, delete, and insert data in the DataSetView, you are also editing, deleting, and inserting data in the StorageDataSet the DataSetView is bound to.
- Set the enableDelete property to false to disable the user's ability to delete data from the StorageDataSet.
- Set the enableInsert property to false to disable the user's ability to insert data into the StorageDataSet.
- Set the enableUpdate property to false to disable the user's ability to update data in the StorageDataSet.