BBjStandardGrid::setAllColumnsUserSortable

Description

In BBj 6.0 and higher, this BBjStandardGrid method enables the sorting of all columns when the user clicks in the column header.

Syntax

Return Value

Method

void

setAllColumnsUserSortable(boolean p_sortable)

Parameters

Variable

Description

p_sortable

Indicates whether the user can sort the column by clicking in the header.

0 = Not sortable.

1 = Sortable.

Return Value

None.

Remarks

None.

Example

rem 'Set all columns user Sortable

rem 'Obtain the instance of the BBjAPI object
let myAPI!=BBjAPI()

rem 'Open the SysGui device
SYSGUI=UNT
OPEN (SYSGUI) "X0"

rem 'Obtain the instance of the BBjSysGui object
let mySysGui!=myAPI!.getSysGui()

rem 'Set addWindow param values
X=10
Y=10
WIDTH=300
HEIGHT=300
TITLE$="BBj Window - Sort"

rem 'Set the current context
mySysGui!.setContext(0)

rem 'Create a window
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$,$000002$)

rem 'Add a grid on the window
myGrid! = myWindow!.addGrid(101,25,25,250,200,$8060$,10,2)

rem 'Add button to the window
sortButton!=myWindow!.addButton(102,90,230,120,30,"Set All Columns Sortable",$$)

rem 'Set the grid properties
myGrid!.setDefaultColumnWidth(130)
myGrid!.setGridEditable(1)
myGrid!.setFitToGrid(1)
myGrid!.setRowHeight(16)
myGrid!.setEditable(1)
myGrid!.setHasColumnHeader(1)

rem 'set the first column sortable by clicking on the Header
myGrid!.setColumnUserSortable(0,1)

rem 'Add text to the grid cells
FOR ROW = 0 TO 9
    FOR COL = 0 TO 1
        CELLTEXT$=STR(ROW+1) +" " + STR(COL+1)
        myGrid!.setCellText(ROW,COL,CELLTEXT$)
    NEXT COL
NEXT ROW

rem 'Register the CALLBACK routines
myGrid!.setCallback(myGrid!.ON_GRID_EDIT_STOP,"CALL_RESORT")
myWindow!.setCallback(myWindow!.ON_CLOSE,"APP_CLOSE")
sortButton!.setCallback(sortButton!.ON_BUTTON_PUSH,"SET_COLUMNS_SORTABLE")

rem 'Process Events
process_events

rem 'Callback routine called when the user closes the application window
APP_CLOSE:
release

CALL_RESORT:
    PRINT "calling resort"
    myGrid!.resort()
return

SET_COLUMNS_SORTABLE:
    if (sortButton!.getText() = "Set All Columns Sortable") then
        sortButton!.setText("Set All Columns non sortable")
        myGrid!.setAllColumnsUserSortable(1)
    else
        sortButton!.setText("Set All Columns Sortable")
        myGrid!.setAllColumnsUserSortable(0)
    endif
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.