How to refresh a browsing DataGroup

  • Edit

DataGroups that displaying rows of data are refreshed by the following ways:

1. By the user by sorting or filtering Form's data columns.

2. By appending, modifying or deleting rows by using Forms in ptAppend, ptEdit or ptDelete mode. Those forms usually are opened by pressing buttons or double-clicking rows on the Browsing Form. In this case in the "Data Group" of the browsing form the properties "Unique Table" and "Unique Field" must be set and be compatible with the appending, modifying or deleting Forms. This type of refresh occurs only in DataGroups that belong in Forms that open in ptBrowse mode.

3. Programmatically. Some examples are given below:

example 1.

    f = TopForm()
    pp = PByName(f,datagroupname)
   
    call OpenFormModal("ptEdit",.....)  {code execution waits until the form is closed}
   
    call LoadRows(pp)                         {pp is the data group that must be refreshed}

example 2.

    f = TopForm()
    pp = PByName(f,datagroupname)

    call OpenFormTop("ptEdit",....)     {here the code execution does not wait and goes to the next line...}

    ....so into the code of the opening form we can put:

    proc Form_End ( uvalue )

           call LoadRows(pp)             {pp is the data group that must be refreshed (belongs to the previous form)}

    end

example 3.

    f = TopForm()
    pp = PByName(f,datagroupname)

    call OpenFormTop("ptEdit",....)     {here the code execution does not wait and goes to the next line...}
    ....so into the code of the opening form we can put:

    proc Form_End ( uvalue )

           call RefreshActiveRow ( fprev, datagroupname, uval )  { only the active row of the browser is refreshed }

    end

If the data group that must be refreshed is of "local" type then before the calling of LoadRows the following two rows must be appended:

    call TFreeClientDataSet(tt)       {where tt is the dataset of the refreshing DataGroup}
   call Panels_Start()                  {...rerun the code that created tt}