Consultor Eletrônico



Kbase 18385: ADM2. How To Use Browse Column Labels To Sort Browse Query
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   05/03/2003
Solution ID: 18385

GOAL:

ADM2. How to program a browse widget to allow users to click on a browse column and have the browse query re-open and sort on the selected column.

FACT(s) (Environment):

Progress 8.x
Progress 9.x

FIX:

1) Create a browse widget and make at least one of its fields updateable.  This example uses the Customer table and displays Cust-Num, Name, and Sales-Rep fields.  Name is enabled.

2) Disable the enabled Name field in the window's MAIN BLOCK after RUN enable_UI:

ASSIGN name:READ-ONLY IN BROWSE BROWSE-1 = TRUE.

This will only need to be done if you want the browser to be read-only.  If you have an updateable browser, enable the appropriate fields and leave them enabled.

3) Create a START-SEARCH trigger for the browse with the following:

DEFINE VARIABLE h-col AS HANDLE NO-UNDO.

ASSIGN h-col = BROWSE-1:CURRENT-COLUMN.

CASE h-col:LABEL:
   WHEN "Cust-Num" THEN
       OPEN QUERY BROWSE-1 FOR EACH customer BY Cust-Num.
    WHEN "Name" THEN
        OPEN QUERY BROWSE-1 FOR EACH customer BY Name.
    WHEN "Sales-Rep" THEN
        OPEN QUERY BROWSE-1 FOR EACH customer BY Sales-Rep.
END CASE.

When this example window is run, clicking on a browse column label will re-open the browse query and sort the query based on the label chosen.