Search Dialogs in Prompt Lists
Modal Dialog Processing
Session Management and Login
This document adds support for a search dialog in our prompt lists. This functionality is managed by pbAutoSearch, Search, OnSearch, and RequestColumnLookup, along with assistance from DDSetChangedValue.
cWebList
Procedure OnSearch String sSearchText
This method is called by the client's JavaScript engine to perform a search on an automatic data-aware list (peDbGridType = gtAutomatic and pbDataAware = true). It performs a lookup search on the passed value based on the current sort column (piSortColumn). This is achieved by sending RequestColumnLookup to the appropriate column object, which finds the target record and refreshes the list.
cWebColumn
Procedure RequestColumnLookup String sSearchText
This method performs a lookup find and list refresh based on the contents of the DD buffer and the value of the search text. It is used by prompt lists to search for a value.
cWebBaseDEO
Procedure DDSetChangedValue String sValue
This method sets the Field_Changed_State of the DDO and the field associated with this DEO. It is used by cWebColumn's RequestColumnLookup method. Since the DD's value is set, this DEO will also be updated with the value. This is essentially a helper function that allows you to set a DD field value without needing to access the Server, Data_File, Data_Field, etc.
Important
This is the recommended way to change the value of a data-bound web DEO during a web request. You should not use WebSet psValue or WebSet pbChanged for this purpose, as those changes are not propagated to the DDO until the next server round trip (and possibly not even then). You should only use WebSet psValue with non-data-aware web DEO controls. If the DEO control has data-binding, use DDSetChangedValue.
For example:
// Performs a lookup style find for the passed column based on the value of the search text
// This is used when you are doing lookup/searches
Procedure RequestColumnLookup String sSearchText
Send DDSetChangedValue sSearchText
Send Request_Find GE
If not Found Begin
Send Request_Find LT
End
End_Procedure
Additionally, here are other methods related to searching in a cWebList.
cWebList
Property Boolean pbAutoSearch True
If True, the search dialog will pop up automatically when the user starts typing. Upon completion, the list will search for that value. If the list is manual and static, the popup and search occur on the client. If the list is automatic (peDbGridType = gtAutomatic and pbDataAware = true), the search must occur on the server by querying the database. The client does this by sending the OnSearch event to the cWebList object with the search text. A search dialog can also be invoked by sending the Search message from the server.
Procedure Search
This sends the showSearch client action to the client, causing the client to pop up the search dialog for the cWebList based on the current sort column (piSortColumn). For example, this button object added to a prompt list dialog would invoke a search dialog when clicked.
Object oSearch_btn is a cWebButton
Set psCaption to C_$Search
Set piColumnIndex to 0
Procedure OnClick
Send Search of oPromptList
End_Procedure
End_Object
Note: In our experience, using WebSet to set a DEO's psValue or pbChanged does not update the DDO object. This behavior differs from Windows, where setting Value in a DEO updates the DDO. We anticipate that developers may encounter this issue. Web Properties lack getters and setters, making augmentation difficult. While we could add special handling for psValue and pbChanged, we prefer to avoid adding more exceptions. Developers are encouraged to create their own custom methods to handle this, although they may not be aware of the need until they encounter the issue. For now, we advise that developers should always update their DDO field values directly and avoid using WebSet psValue. Use WebSet psValue only with non-data-bound controls. To simplify this process, we created DDSetChangedValue for DEOs, allowing you to set a DEO's field value with a single line of code.
Previous Topic: Modal Dialog Processing
Next Topic: Session Management and Login