3B. Upgrading BBjGrids
4. Setting up a Simple BBjGridExWidget for DWC
The ResultSet we have created in the section can now be loaded into a BBjGridExWidget, using the setData method of its API:
use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget
use com.basiscomponents.db.ResultSet
use com.basiscomponents.db.DataRow
wnd! = BBjAPI().openSysGui("X0").addWindow("Hello BBj DWC", $01111083$)
wnd!.setPanelStyle("height","100%")
cw! = wnd!.addChildWindow("",$00108000$,BBjAPI().getSysGui().getAvailableContext())
cw!.setStyle("height","100%")
cw!.setStyle("width","100%")
grid! = new BBjGridExWidget(cw!)
rs! = new ResultSet()
record! = new DataRow()
record!.setFieldValue("LAST_NAME","Picard")
record!.setFieldValue("FIRST_NAME","Jean-Luc")
rs!.add(record!)
record! = new DataRow()
record!.setFieldValue("LAST_NAME","Spock")
record!.setFieldValue("FIRST_NAME","S'Chn T'Gai")
rs!.add(record!)
record! = new DataRow()
record!.setFieldValue("LAST_NAME","Uhura")
record!.setFieldValue("FIRST_NAME","Nyota")
rs!.add(record!)
grid!.setData(rs!)
process_events
Run this program in DWC and you will see a grid that takes the full browser canvas to display a BBjGridExWidget.Source code: https://github.com/BasisHub/DWCTraining/tree/main/3C_Grid2GridEx
Styling and Configuring the Grid
Now that we have the basic functionality of loading data into a grid working, we can have a look at some examples that illustrate often needed functionality. You find the demos in the subfolder "demos" of the BBjGridExWidget plug-in on your disk, or you can browse them online on GitHub.