Kbase P135406: How to reposition a SmartDataBrowser with the selected row in a specific position in the browse
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  24/09/2008 |
|
Status: Unverified
GOAL:
How to reposition a SmartDataBrowser with the selected row in a specific position in the browse
FACT(s) (Environment):
Windows
Progress 9.x
OpenEdge 10.x
FIX:
Let's say you want to reposition to a specific record in a SDB and you want that record to be displayed at the bottom of the browse viewport. The following example demonstrates one way to accomplish this.
1) First you want to reposition. The SmartDataObject (SDO), or SmartBusinessObject (SBO), that is attached to the browse is the place to do this and the best method to use is findRowWhere. This method allows you to pass column names and values along with an operator and assumes that you want to reposition to the first row to match the predicate.
e.g.
DYNAMIC-FUNCTION('findRowWhere' IN h_sdo,
INPUT 'custnum', /* Column list - separated by commas*/
INPUT '1000', /* Value list - separated by CHR(1) */
INPUT '>'). /* Operator - one for all comparisons */
2) Next you want to make sure that the position of the selected row in the viewport is at the bottom of the browse. The SET-REPOSITIONED-ROW method of the browse widget allows you to set the row index where records are positioned when the REPOSITION TO ROWID|RECID methods are used. This method is used internally by the ADM to ensure a uniform look and feel when positioning up and down the browse viewport but can be overriden.
The second parameter of this method allows you to specify whether to apply this behavior ALWAYS or CONDITIONALly depending upon whether the row is already visible within the viewport. The ADM code always uses the CONDITIONAL value so this can be overridden using ALWAYS. This should be done in an early method of the SmartDataBrowse procedure like initialzeObject (after SUPER).
e.g.
PROCEDURE initializeObject:
RUN SUPER.
BROWSE br_table:SET-REPOSITIONED-ROW(6, /* Assumes the browse has 6 rows visible in the viewport */
'ALWAYS').
END PROCEDURE.