Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
This is a sample of how to use a list view to navigate through the records of a ListView and keep the ListView in synch with the BO. A SF ListView was subclassed to add the synching functionality. See the project for info on how it was done. The project uses the StrataFrameSample db.
Features:
- Fairly easy to setup.
- Handles adding, updating and deleting within the BO
- Selecting an item in the list navigates to that item in the BO.
- Navigation of the BO automatically updates selected item in the list.
- Filling the data table automatically updates the list and synchs it
Usage:
- Drop a BO on the form
- Drop this control on the form
- Setup the columns for the listview (normal SF procedure)
- Setup the Population list settings. The method must be CopyDataFrom using the business layer overload.
- Set the BO of the synch list control
These are the basics. The last step depends on how you will load the BO. In the sample, the BO is simply loaded when the form is loaded. In that case, have the list load when the form is loaded also and be sure the initialization priority of the list to be larger than the priority of the form (the BO needs to be loaded first).
If you load the BO manually, then the list should be loaded manually also. Whenever you load the BO, simply call the UpdateAndSynch() method of the list after loading.
I typically will call the SelectFirstListItem() method after the load in order to make sure that the first item in the list is selected. This could probably be built in, but isn't at this point.
As always, comments/suggestions/improvements are welcome and appreciated!
Greg
|