Search Dialogs in Prompt Lists

Modal Dialog Processing

Session Management and Login


This adds support for a search dialog in our prompt lists. This is all handled by pbAutoSearch, Search, OnSearch and RequestColumnLookup along with a little help from DDSetChangedValue.



Procedure OnSearch String sSearchText

This 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). It does this by sending RequestColumnLookup to the appropriate column object, which will find the target record and refresh the list.




Procedure RequestColumnLookup String sSearchText

Performs a lookup find and list refresh based on the contents of the DD buffer plus the value of this search  text. This is used by prompt lists to search for a value.




Procedure DDSetChangedValue String sValue

Sets the Field_Changed_State of the DDO and field that is associated with this DEO. This is used by cWebColumn's RequestColumnLookup method. Because the DD's value is set, this DEO will also be updated with the value. This is really just a helper function that lets you set a DD field value without having to get the Server, Data_File, Data_Field, etc.


This is the recommended way of change the value of an data-bound web DEO during a web request. You should not use "WebSet psValue" or "WebSet pbChanged" to do this because those changes are not propagated to the DDO until the next server round trip (and maybe not even then). You should only "WebSet psValue" with non-data aware web DEO controls. If the DEO control has data-binding use DDSetChangedValue.

For example:

    // does 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




In addition, here are the other methods with information about searching a cWebList.




Property Boolean pbAutoSearch True

If true the search dialog will popup 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 the search occurs on the client. If the list is automatic (peDbGridType = gtAutomatic and pbDataAware = true), the search must take place on the server by searching for the data from your database. The client does this by sending the OnSearch event  to the cWebList object passing 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. This will cause the client to popup the search dialog for the cWebList based around 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




Note: In doing this we realized that using WebSet to set a DEO's psValue or pbChanged does not update the DDO object. This is different than Windows where setting Value in a DEO updates the DDO. We expect that people will bump into this. Web Properties don't have getters and setters so it is hard to augment them.  We could add special code for psValue and pbChanged but we kind of hate to add more exceptions. One could create their own custom method that would do this but you are not likely to know about this until you've made the mistake. For now we felt the best thing to do is to tell developers that they should always update their DDO field values directly and never attempt to do this via WebSet psValue. You would only use WebSet psValue with non-data bound controls. To make this a little bit easier, we created the DDSetChangedValue for DEOs that allows 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


See Also

Developing Web Applications