Pattern 5: Re-used Search Facility

Previous Next

See Also

In this design pattern, a Search facility for a parent table is inserted into a page that shows parent-child results. This Search facility exists in an existing page class, which is embedded in another page. The data sources in both pages need to be synchronized.

To embed a page in another page, and synchronize the data sources:

1. First decide whether the only purpose of this page is to be embedded and used in another page. If NOT, define a new PageToBeEmbedded subclass.
2. From the Web Designer catalog, open the page to be embedded.

In the design pattern, this is the page that offers the Search facility.

3. Make all necessary changes to this page.

In the design pattern, you can for example remove all functionality that has nothing to do with searching, like the ResultGroup.

4. Save your changes.
5. From the Web Designer catalog, open the "target" page, in which the search facility is to be embedded.
6. From the Web Designer catalog, drag the page to be embedded to the main (Page) object of the "target" page.

A new page object appears in the object tree, let's say PageToBeEmbedded1.

7. For this embedded page object, select the TableDataSource object.
8. Set the Synchronization DataSource property to:

../<MAINTABLE>

where MAINTABLE is the data source name of the table in the "target" page, for example:

../TOUR

Now, the data sources in both pages are synchronized.

9. Save your changes.

In this picture, a SearchTours page is embedded in a MyTours page, and both TOUR data sources are synchronized.