diff --git a/.vscode/settings.json b/.vscode/settings.json
index c0413bbb..d4e92f6e 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -331,6 +331,10 @@
"editbox.bbj": {
"name": "editbox",
"style": ""
+ },
+ "AlignedGrids.bbj": {
+ "name": "AlignedGrids",
+ "style": ""
}
},
"cSpell.words": [
diff --git a/BBjGridExWidget.bbj b/BBjGridExWidget.bbj
index cfb9d366..c8e9da4f 100644
--- a/BBjGridExWidget.bbj
+++ b/BBjGridExWidget.bbj
@@ -130,3848 +130,3869 @@ rem * @author Stephan Wald
rem * @author Hyyan Abo Fakher
rem */
class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterface
- rem /**
- rem * The Grid enterprise key
- rem */
- field public static BBjString LicenseKey$
- rem /**
- rem * When true, the grid will force using the community version of the grid whether there
- rem * is a license key or not.
- rem */
- field public static BBjNumber ForceCommunityBuild! = 0
- rem /**
- rem * When true the grid will use the unmingled version of the Javascript code then open the debugger
- rem * in a new window.
- rem */
- field public static BBjNumber Debug! = 0
- rem /**
- rem * The unique string to use as row index. default is __ROW_INDEX
- rem */
- field public BBjString RowNodeId$ = "__ROW_INDEX"
- rem /**
- rem * The ResultSet instance
- rem */
- field public ResultSet RS! = new ResultSet()
- rem /**
- rem * Columns Manager instance
- rem */
- field public GxColumnsManager ColumnsManager! = new GxColumnsManager()
- rem /**
- rem * Instance of the grid options class
- rem */
- field public GxOptions Options! = new GxOptions(#this!)
- rem /**
- rem * Instance of he scripts executor
- rem */
- field public GxExecutor Executor! = new GxExecutor(#this!, 250)
- rem /**
- rem * Instance of the created HTMLView
- rem */
- field public BBjHtmlView HTMLView!
- rem /**
- rem * A flag which defines when the grid is ready and the process events started
- rem */
- field public Boolean IsReady! = BBjAPI.FALSE
- rem /**
- rem * Instance of GxClientJsonFactory to convert client JSON strings to Client Models
- rem */
- field protected GxClientJsonFactory ClientJsonFactory! = new GxClientJsonFactory(#this!)
- rem /**
- rem * The vector holds the registered events
- rem */
- field protected JsonArray Interests! = new JsonArray()
- rem /**
- rem * An array which contains the supported toolbar items
- rem */
- field protected JsonArray ChartToolbarItems! = new JsonArray()
- rem /**
- rem * The client's HTML template to use in order to build the grid.
- rem */
- field protected BBjString Template$ = ""
- rem /**
- rem * Instance of the grid's license manager
- rem */
- field protected static LicenseManager LicenseManager! = new LicenseManager()
- rem /**
- rem * A boolean which indicates whether the grid has its first renderer
- rem */
- field protected Boolean IsFirstRender! = BBjAPI.TRUE
- rem /**
- rem * Unique auto-generated id for the grid instance.
- rem * This id is used in the client to distinguish instances
- rem */
- field protected BBjString RootId!
- rem /**
- rem * Number of initiated instances per session
- rem */
- field protected static BBjNumber InstanceCount! = 0
- field protected BBjNumber newW!
- field protected BBjNumber newH!
- rem /**
- rem * A Constant value to define row selection (selected/deselected) change events
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_SELECT_ROW()
- methodret BBjAPI.ON_GRID_SELECT_ROW
- methodend
- rem /**
- rem * Alias for ON_GRID_SELECT_ROW
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_ROW_SELECT()
- methodret #ON_GRID_SELECT_ROW()
- methodend
- rem /**
- rem * Constant value to define row double-click event
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_ROW_DOUBLE_CLICK()
- methodret BBjAPI.ON_GRID_DOUBLE_CLICK
- methodend
- rem /**
- rem * Alias to ON_GRID_ROW_DOUBLE_CLICK()
- rem *
- rem * @see ON_GRID_ROW_DOUBLE_CLICK()
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_DOUBLE_CLICK()
- methodret #ON_GRID_ROW_DOUBLE_CLICK()
- methodend
- rem /**
- rem * Constant value to define cell click event
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_CELL_CLICK()
- methodret 5001
- methodend
- rem /**
- rem * Constant value to define cell double-click event
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_CELL_DOUBLE_CLICK()
- methodret 5002
- methodend
- rem /**
- rem * Constant value to define cell editing start event
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_CELL_EDITING_STARTED()
- methodret 5003
- methodend
- rem /**
- rem * Constant value to define cell editing stop event
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_CELL_EDITING_STOPPED()
- methodret 5004
- methodend
- rem /**
- rem * Constant value to define cell value changed event
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_CELL_VALUE_CHANGED()
- methodret 5005
- methodend
- rem /**
- rem * Constant value to define row editing start event
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_ROW_EDITING_STARTED()
- methodret 5006
- methodend
- rem /**
- rem * Constant value to define row editing stop event
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_ROW_EDITING_STOPPED()
- methodret 5007
- methodend
- rem /**
- rem * Constant value to define grid state changes
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_STATE_CHANGE()
- methodret 5008
- methodend
- rem /**
- rem * Constant value to define range selection event
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_RANGE_SELECTION_CHANGED()
- methodret 5009
- methodend
- rem /**
- rem * Constant value to define keyboard keypress
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_KEYPRESS()
- methodret 5010
- methodend
- rem /**
- rem * Constant value to define row click events
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_ROW_CLICK()
- methodret 5011
- methodend
- rem /**
- rem * Constant value to define A row has changed.
- rem * This event corresponds to Full Row Editing only.
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_ROW_VALUE_CHANGED()
- methodret 5012
- methodend
- rem /**
- rem * Constant value to define A filter changed event.
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_FILTER_CHANGED()
- methodret 5013
- methodend
- rem /**
- rem * Constant value to define the grid ready event.
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_READY()
- methodret 5014
- methodend
- rem /**
- rem * Alias for ON_GRID_STATE_CHANGE()
- rem *
- rem * @see ON_GRID_STATE_CHANGE()
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber ON_GRID_COLUMN_STATE_CHANGE()
- methodret #ON_GRID_STATE_CHANGE()
- methodend
- rem /**
- rem * Constant value to define left aligned column
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber GRID_ALIGN_LEFT()
- methodret BBjGrid.GRID_ALIGN_LEFT
- methodend
- rem /**
- rem * Constant value to define right aligned column
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber GRID_ALIGN_RIGHT()
- methodret BBjGrid.GRID_ALIGN_RIGHT
- methodend
- rem /**
- rem * Constant value to define centered column
- rem *
- rem * @return BBjNumber
- rem */
- method public static BBjNumber GRID_ALIGN_CENTER()
- methodret BBjGrid.GRID_ALIGN_CENTER
- methodend
- rem /**
- rem * Constant value to define row position
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_ROWPOS_TOP()
- methodret "top"
- methodend
- rem /**
- rem * Constant value to define row position
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_ROWPOS_MIDDLE()
- methodret "middle"
- methodend
- rem /**
- rem * Constant value to define row position
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_ROWPOS_BOTTOM()
- methodret "bottom"
- methodend
- rem /**
- rem * Constant value to define editing mode "row"
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_EDITTYPE_ROW()
- methodret "fullRow"
- methodend
- rem /**
- rem * Constant value to define editing mode "cell"
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_EDITTYPE_CELL()
- methodret ""
- methodend
- rem /**
- rem * Constant value to define enter key behavior (Move to next cell)
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_ENTER_NEXT_CELL()
- methodret "next"
- methodend
- rem /**
- rem * Constant value to define navigation behavior (Move to next cell)
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_NAVIGATION_BEHAVIOUR_NEXT_CELL()
- methodret "navigate_next_cell"
- methodend
- rem /**
- rem * Constant value to define navigation behavior (Move to next row)
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_NAVIGATION_BEHAVIOUR_NEXT_ROW()
- methodret "navigate_next_row"
- methodend
- rem /**
- rem * Constant value to define enter key behavior (Stop editing)
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_ENTER_STOP_EDITING()
- methodret "stop"
- methodend
- rem /**
- rem * Constant value which defines that group panel must always be shown
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_GROUPPANEL_SHOW_VISIBLE()
- methodret "always"
- methodend
- rem /**
- rem * Constant value which defines that group panel must be shown only when grouping
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_GROUPPANEL_SHOW_ONGROUPING()
- methodret "onlyWhenGrouping"
- methodend
- rem /**
- rem * Constant value which defines that group panel must always be hidden
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_GROUPPANEL_SHOW_HIDDEN()
- methodret "never"
- methodend
- rem /**
- rem * Constant value which describes the rows in before sorting and
- rem * filtering phase.
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_ROWS_PHASE_ALL()
- methodret "forEachNode"
- methodend
- rem /**
- rem * Constant value which describes the rows in after filtering phase.
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_ROWS_PHASE_AFTER_FILTER()
- methodret "forEachNodeAfterFilter"
- methodend
- rem /**
- rem * Constant value which describes the rows in after filtering and sorting
- rem * phase.
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_ROWS_PHASE_AFTER_FILTER_SORT()
- methodret "forEachNodeAfterFilterAndSort"
- methodend
- rem /**
- rem * Constant value which defines that chart toolbar settings item
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString CHART_TOOLBAR_SETTINGS()
- methodret "chartSettings"
- methodend
- rem /**
- rem * Constant value which defines that chart toolbar data item
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString CHART_TOOLBAR_DATA()
- methodret "chartData"
- methodend
- rem /**
- rem * Constant value which defines that chart toolbar format item
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString CHART_TOOLBAR_FORMAT()
- methodret "chartFormat"
- methodend
- rem /**
- rem * Constant value which defines that chart toolbar download item
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString CHART_TOOLBAR_DOWNLOAD()
- methodret "chartDownload"
- methodend
- rem /**
- rem * Constant value which defines that balham theme
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_THEME_BALHAM()
- methodret "balham"
- methodend
- rem /**
- rem * Constant value which defines that balham dark theme
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_THEME_BALHAM_DARK()
- methodret "balham-dark"
- methodend
- rem /**
- rem * Constant value which defines the material theme
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_THEME_MATERIAL()
- methodret "material"
- methodend
- rem /**
- rem * Constant value which defines the alpine theme
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_THEME_ALPINE()
- methodret "alpine"
- methodend
- rem /**
- rem * Constant value which defines the alpine dark theme
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_THEME_ALPINE_DARK()
- methodret "alpine-dark"
- methodend
- rem /**
- rem * Constant value which defines the rows floating on top
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_FLOATING_TOP()
- methodret "top"
- methodend
- rem /**
- rem * Constant value which defines the rows floating on bottom
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_FLOATING_BOTTOM()
- methodret "bottom"
- methodend
- rem /**
- rem * Constant value which defines the rows with no floating
- rem *
- rem * @return BBjString
- rem */
- method public static BBjString GRID_FLOATING_NONE()
- methodret ""
- methodend
- rem /**
- rem * Make Hex Color
- rem *
- rem * Convert the given BBjColor to a hex color string
- rem *
- rem * @param BBjColor color! BBj color
- rem *
- rem * @return BBjString hex color
- rem */
- method public static BBjString makeHexColor(BBjColor color!)
- methodret "#"+hta(chr(color!.getRed()))+hta(chr(color!.getGreen()))+hta(chr(color!.getBlue()))
- methodend
- rem /**
- rem * Convert the image at the given path to base64 string
- rem *
- rem * @param BBjString filename! The image's path
- rem *
- rem * @return BBjString Image as base64 string
- rem */
- method public static BBjString imageToBase64(BBjString filename!)
- imageSlice!=BBjAPI().getSysGui().getImageManager().loadImageFromFile(filename!)
- bytes$ = str(imageSlice!.getBytes("png"))
- b64$ = java.util.Base64.getEncoder().encode(bytes$)
- methodret "data:image/png;base64, "+b64$
- methodend
- rem /**
- rem * Alias for imageToBase64()
- rem *
- rem * @see imageToBase64()
- rem */
- method public static BBjString getImageData(BBjString filename!)
- methodret BBjGridExWidget.imageToBase64(filename!)
- methodend
- rem /**
- rem * The method will check whether the grid has license key or not.
- rem *
- rem * @return BBjNumber true when a license key is found, false otherwise
- rem */
- method public static BBjNumber isLicensed()
- #getLicenseManager().setLicenseKey(#getLicenseKey())
- methodret #getLicenseManager().isLicensed()
- methodend
- rem /**
- rem * disabled default constructor
- rem */
- method public BBjGridExWidget()
- methodend
- rem /**
- rem * The constructor that creates the widget on wnd!
- rem *
- rem * @param BBjWindow wnd!! parent window
- rem * @param BBjNumber id! the control ID
- rem * @param BBjNumber x! x-location
- rem * @param BBjNumber y! y-location
- rem * @param BBjNumber w! width
- rem * @param BBjNumber h! height
- rem */
- method public BBjGridExWidget(BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h!)
- #create(wnd!,id!,x!,y!,w!,h!,"")
- methodend
- rem /**
- rem * The constructor that creates the widget on wnd!
- rem *
- rem * @param BBjWindow wnd!! parent window
- rem * @param BBjNumber id! the control ID
- rem * @param BBjNumber x! x-location
- rem * @param BBjNumber y! y-location
- rem * @param BBjNumber w! width
- rem * @param BBjNumber h! height
- rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
- rem * By default you will never need to change the default Template.
- rem * Unless you want to do something really unusual
- rem */
- method public BBjGridExWidget(BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h! , BBjString template$)
- #create(wnd!,id!,x!,y!,w!,h!,template$)
- methodend
- rem /**
- rem * The constructor that creates the widget in the ChildWindow
- rem *
- rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
- rem */
- method public BBjGridExWidget(BBjChildWindow wnd!)
- #create(wnd!,"")
- methodend
- rem /**
- rem * The constructor that creates the widget in the ChildWindow
- rem *
- rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
- rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
- rem * By default you will never need to change the default Template.
- rem * Unless you want to do something really unusual
- rem */
- method public BBjGridExWidget(BBjChildWindow wnd!,BBjString template$)
- #create(wnd!,template$)
- methodend
- rem /**
- rem * Create the widget
- rem *
- rem * @param BBjWindow wnd!! parent window
- rem * @param BBjNumber id! the control ID
- rem * @param BBjNumber x! x-location
- rem * @param BBjNumber y! y-location
- rem * @param BBjNumber w! width
- rem * @param BBjNumber h! height
- rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
- rem * By default you will never need to change the default Template.
- rem * Unless you want to do something really unusual
- rem *
- rem * @Override
- rem */
- method protected void create(BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h!, BBjString template$)
- #super!.setCanvas(wnd!.addChildWindow(id!,x!,y!,w!,h!,"",$00000800$,BBjAPI().getSysGui().getAvailableContext()))
- #super!.setX(x!)
- #super!.setY(y!)
- #super!.setW(w!)
- #super!.setH(h!)
- #RS!.createIndex()
- #fillChartToolbarItems()
- #setTemplate(template$)
- #redraw(BBjAPI.TRUE)
- methodend
- rem /**
- rem * Create the widget
- rem *
- rem * @param BBjWindow wnd!! parent window
- rem * @param BBjNumber id! the control ID
- rem * @param BBjNumber x! x-location
- rem * @param BBjNumber y! y-location
- rem * @param BBjNumber w! width
- rem * @param BBjNumber h! height
- rem *
- rem * @Override
- rem */
- method protected void create(BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h!)
- #create(wnd!,id!,x!,y!,w!,h!,"")
- methodend
- rem /**
- rem * Create the widget
- rem *
- rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
- rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
- rem * By default you will never need to change the default Template.
- rem * Unless you want to do something really unusual
- rem *
- rem * @Override
- rem */
- method protected void create(BBjChildWindow wnd!,BBjString template$)
- #super!.setCanvas(wnd!)
- #super!.setX(wnd!.getX())
- #super!.setY(wnd!.getY())
- #super!.setW(wnd!.getWidth())
- #super!.setH(wnd!.getHeight())
- #RS!.createIndex()
- #fillChartToolbarItems()
- #setTemplate(template$)
- #redraw(BBjAPI.TRUE)
- methodend
- rem /**
- rem * Create the widget
- rem *
- rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
- rem * @param BBjString template$ the html template to use for the grid initialization
- rem *
- rem * @Override
- rem */
- method protected void create(BBjChildWindow wnd!)
- #create(wnd!,"")
- methodend
- REM /**
- REM * Get the unique control type
- REM *
- REM * @returns int controlType = 65001
- REM */
- method public int getControlType()
- methodret 65001
- methodend
- rem /**
- rem * Register an event handler
- rem *
- rem * @param Int type! The event's type
- rem * @param String callback! The event's callback
- rem *
- rem * @Override
- rem */
- method public void setCallback(int type!, String callback!)
- #super!.setCallback(type!,callback!)
- #getInterests().add(type!)
- #updateClientWithInterests()
- methodend
- rem /**
- rem * Register an event handler
- rem *
- rem * @param Int type! The event's type
- rem * @param CustomObject instance! class instance
- rem * @param String method! method name
- rem *
- rem * @Override
- rem */
- method public void setCallback(int type!, CustomObject instance!, String method!)
- #super!.setCallback(type!, instance!, method!)
- #getInterests().add(type!)
- #updateClientWithInterests()
- methodend
- rem /**
- rem * Remove callback
- rem *
- rem * @param Int type! The event's type
- rem *
- rem * @Override
- rem */
- method public void clearCallback(int type!)
- #super!.clearCallback(type!)
- interests! = #getInterests()
- el! = new JsonPrimitive(type!)
-
- if(interests!.contains(el!)) then
- interests!.remove(el!)
- #updateClientWithInterests()
- FI
- methodend
- rem /**
- rem * Enable remote debugging on the given port
- rem *
- rem * @param BBjNumber debug! true to enable debug , false otherwise
- rem * @param BBjNumber port! the debugging port
- rem *
- rem * @return void
- rem */
- method public static void setDebug(BBjNumber debug! , BBjNumber port!)
- if(debug!.booleanValue())
- chromiumSwitches$ = stbl("!CHROMIUM_SWITCHES","--remote-debugging-port=" + str(port!))
- FI
-
- #Debug! = debug!
- methodend
- rem /**
- rem * Enable remote debugging on the 9222 port
- rem *
- rem * @param BBjNumber debug! true to enable debug , false otherwise
- rem *
- rem * @return void
- rem */
- method public static void setDebug(BBjNumber debug!)
- #setDebug(Debug! , 9222)
- methodend
- rem /**
- rem * Get the root id of the grid
- rem *
- rem * The root id is a unique & auto-generated id for the grid instance.
- rem * This id is used in the client to distinguish the grid instances
- rem *
- rem * @return BBjString the root id
- rem */
- method public BBjString getRootId()
- if(null() = #RootId!)
- #InstanceCount! = #InstanceCount! + 1
- #RootId! = "gx-grid-" + str(#InstanceCount!)
- FI
-
- methodret #RootId!
- methodend
- rem /**
- rem * Return the number of initiated instances of the grid
- rem *
- rem * @return BBjNumber The number of instances
- rem */
- method public static BBjNumber getInstanceCount()
- methodret #InstanceCount!
- methodend
- rem /**
- rem * @Override
- rem *
- rem * This method is called whenever the widget needs to be rendered
- rem *
- rem * @param Boolean f_init! if TRUE then the control is rendered for the first time so this method
- rem * has to perform initial rendering
- rem */
- method public void redraw(Boolean f_init!)
- declare BBjHtmlView htmlview!
-
- if (f_init!) then
- rem @see https://bugzilla.basis.com/show_bug.cgi?id=33048
- enableInternalSpecialKeysHandling! = stbl("!OPTIONS","HTMLVIEW_INTERNAL_TABS=TRUE")
- html$ = #getTemplate()
- htmlview! = #getCanvas().addHtmlView(101,0,0,#getCanvas().getWidth(),#getCanvas().getHeight(),"",$0000$)
- htmlview!.setOpaque(0)
- htmlview!.setNoEdge(1)
- htmlview!.setTabTraversable(1)
- htmlview!.setFocusable(1)
- htmlview!.addStyle("htmlview-" + #getRootId())
-
- if (info(3,6)="6" AND AND(#getCanvas().getWindowFlags(),$00100000$) = $00100000$) then
- rem in DWC, if parent window is client-side sized, make the htmlview same size as surrunding canvas
- htmlview!.setStyle("width","100%")
- htmlview!.setStyle("height","100%")
- fi
-
-
- if (info(3,6)<"5" and #getDebug() > 0) then
- url$ = htmlview!.getAttribute("remoteDebuggingURL")
-
- if url$>"" then
- a = scall("bbj BBjGridExWidget/util/DebugWindow.bbj - "+url$+" &")
+ rem /**
+ rem * The Grid enterprise key
+ rem */
+ field public static BBjString LicenseKey$
+ rem /**
+ rem * When true, the grid will force using the community version of the grid whether there
+ rem * is a license key or not.
+ rem */
+ field public static BBjNumber ForceCommunityBuild! = 0
+ rem /**
+ rem * When true the grid will use the unmingled version of the Javascript code then open the debugger
+ rem * in a new window.
+ rem */
+ field public static BBjNumber Debug! = 0
+ rem /**
+ rem * The unique string to use as row index. default is __ROW_INDEX
+ rem */
+ field public BBjString RowNodeId$ = "__ROW_INDEX"
+ rem /**
+ rem * The ResultSet instance
+ rem */
+ field public ResultSet RS! = new ResultSet()
+ rem /**
+ rem * Columns Manager instance
+ rem */
+ field public GxColumnsManager ColumnsManager! = new GxColumnsManager()
+ rem /**
+ rem * Instance of the grid options class
+ rem */
+ field public GxOptions Options! = new GxOptions(#this!)
+ rem /**
+ rem * Instance of he scripts executor
+ rem */
+ field public GxExecutor Executor! = new GxExecutor(#this!, 250)
+ rem /**
+ rem * Instance of the created HTMLView
+ rem */
+ field public BBjHtmlView HTMLView!
+ rem /**
+ rem * A flag which defines when the grid is ready and the process events started
+ rem */
+ field public Boolean IsReady! = BBjAPI.FALSE
+ rem /**
+ rem * Instance of GxClientJsonFactory to convert client JSON strings to Client Models
+ rem */
+ field protected GxClientJsonFactory ClientJsonFactory! = new GxClientJsonFactory(#this!)
+ rem /**
+ rem * The vector holds the registered events
+ rem */
+ field protected JsonArray Interests! = new JsonArray()
+ rem /**
+ rem * An array which contains the supported toolbar items
+ rem */
+ field protected JsonArray ChartToolbarItems! = new JsonArray()
+ rem /**
+ rem * The client's HTML template to use in order to build the grid.
+ rem */
+ field protected BBjString Template$ = ""
+ rem /**
+ rem * Instance of the grid's license manager
+ rem */
+ field protected static LicenseManager LicenseManager! = new LicenseManager()
+ rem /**
+ rem * A boolean which indicates whether the grid has its first renderer
+ rem */
+ field protected Boolean IsFirstRender! = BBjAPI.TRUE
+ rem /**
+ rem * Unique auto-generated id for the grid instance.
+ rem * This id is used in the client to distinguish instances
+ rem */
+ field protected BBjString RootId!
+ rem /**
+ rem * Number of initiated instances per session
+ rem */
+ field protected static BBjNumber InstanceCount! = 0
+ field protected BBjNumber newW!
+ field protected BBjNumber newH!
+ rem /**
+ rem * A Constant value to define row selection (selected/deselected) change events
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_SELECT_ROW()
+ methodret BBjAPI.ON_GRID_SELECT_ROW
+ methodend
+ rem /**
+ rem * Alias for ON_GRID_SELECT_ROW
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_ROW_SELECT()
+ methodret #ON_GRID_SELECT_ROW()
+ methodend
+ rem /**
+ rem * Constant value to define row double-click event
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_ROW_DOUBLE_CLICK()
+ methodret BBjAPI.ON_GRID_DOUBLE_CLICK
+ methodend
+ rem /**
+ rem * Alias to ON_GRID_ROW_DOUBLE_CLICK()
+ rem *
+ rem * @see ON_GRID_ROW_DOUBLE_CLICK()
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_DOUBLE_CLICK()
+ methodret #ON_GRID_ROW_DOUBLE_CLICK()
+ methodend
+ rem /**
+ rem * Constant value to define cell click event
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_CELL_CLICK()
+ methodret 5001
+ methodend
+ rem /**
+ rem * Constant value to define cell double-click event
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_CELL_DOUBLE_CLICK()
+ methodret 5002
+ methodend
+ rem /**
+ rem * Constant value to define cell editing start event
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_CELL_EDITING_STARTED()
+ methodret 5003
+ methodend
+ rem /**
+ rem * Constant value to define cell editing stop event
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_CELL_EDITING_STOPPED()
+ methodret 5004
+ methodend
+ rem /**
+ rem * Constant value to define cell value changed event
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_CELL_VALUE_CHANGED()
+ methodret 5005
+ methodend
+ rem /**
+ rem * Constant value to define row editing start event
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_ROW_EDITING_STARTED()
+ methodret 5006
+ methodend
+ rem /**
+ rem * Constant value to define row editing stop event
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_ROW_EDITING_STOPPED()
+ methodret 5007
+ methodend
+ rem /**
+ rem * Constant value to define grid state changes
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_STATE_CHANGE()
+ methodret 5008
+ methodend
+ rem /**
+ rem * Constant value to define range selection event
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_RANGE_SELECTION_CHANGED()
+ methodret 5009
+ methodend
+ rem /**
+ rem * Constant value to define keyboard keypress
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_KEYPRESS()
+ methodret 5010
+ methodend
+ rem /**
+ rem * Constant value to define row click events
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_ROW_CLICK()
+ methodret 5011
+ methodend
+ rem /**
+ rem * Constant value to define A row has changed.
+ rem * This event corresponds to Full Row Editing only.
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_ROW_VALUE_CHANGED()
+ methodret 5012
+ methodend
+ rem /**
+ rem * Constant value to define A filter changed event.
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_FILTER_CHANGED()
+ methodret 5013
+ methodend
+ rem /**
+ rem * Constant value to define the grid ready event.
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_READY()
+ methodret 5014
+ methodend
+ rem /**
+ rem * Alias for ON_GRID_STATE_CHANGE()
+ rem *
+ rem * @see ON_GRID_STATE_CHANGE()
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber ON_GRID_COLUMN_STATE_CHANGE()
+ methodret #ON_GRID_STATE_CHANGE()
+ methodend
+ rem /**
+ rem * Constant value to define left aligned column
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber GRID_ALIGN_LEFT()
+ methodret BBjGrid.GRID_ALIGN_LEFT
+ methodend
+ rem /**
+ rem * Constant value to define right aligned column
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber GRID_ALIGN_RIGHT()
+ methodret BBjGrid.GRID_ALIGN_RIGHT
+ methodend
+ rem /**
+ rem * Constant value to define centered column
+ rem *
+ rem * @return BBjNumber
+ rem */
+ method public static BBjNumber GRID_ALIGN_CENTER()
+ methodret BBjGrid.GRID_ALIGN_CENTER
+ methodend
+ rem /**
+ rem * Constant value to define row position
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_ROWPOS_TOP()
+ methodret "top"
+ methodend
+ rem /**
+ rem * Constant value to define row position
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_ROWPOS_MIDDLE()
+ methodret "middle"
+ methodend
+ rem /**
+ rem * Constant value to define row position
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_ROWPOS_BOTTOM()
+ methodret "bottom"
+ methodend
+ rem /**
+ rem * Constant value to define editing mode "row"
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_EDITTYPE_ROW()
+ methodret "fullRow"
+ methodend
+ rem /**
+ rem * Constant value to define editing mode "cell"
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_EDITTYPE_CELL()
+ methodret ""
+ methodend
+ rem /**
+ rem * Constant value to define enter key behavior (Move to next cell)
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_ENTER_NEXT_CELL()
+ methodret "next"
+ methodend
+ rem /**
+ rem * Constant value to define navigation behavior (Move to next cell)
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_NAVIGATION_BEHAVIOUR_NEXT_CELL()
+ methodret "navigate_next_cell"
+ methodend
+ rem /**
+ rem * Constant value to define navigation behavior (Move to next row)
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_NAVIGATION_BEHAVIOUR_NEXT_ROW()
+ methodret "navigate_next_row"
+ methodend
+ rem /**
+ rem * Constant value to define enter key behavior (Stop editing)
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_ENTER_STOP_EDITING()
+ methodret "stop"
+ methodend
+ rem /**
+ rem * Constant value which defines that group panel must always be shown
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_GROUPPANEL_SHOW_VISIBLE()
+ methodret "always"
+ methodend
+ rem /**
+ rem * Constant value which defines that group panel must be shown only when grouping
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_GROUPPANEL_SHOW_ONGROUPING()
+ methodret "onlyWhenGrouping"
+ methodend
+ rem /**
+ rem * Constant value which defines that group panel must always be hidden
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_GROUPPANEL_SHOW_HIDDEN()
+ methodret "never"
+ methodend
+ rem /**
+ rem * Constant value which describes the rows in before sorting and
+ rem * filtering phase.
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_ROWS_PHASE_ALL()
+ methodret "forEachNode"
+ methodend
+ rem /**
+ rem * Constant value which describes the rows in after filtering phase.
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_ROWS_PHASE_AFTER_FILTER()
+ methodret "forEachNodeAfterFilter"
+ methodend
+ rem /**
+ rem * Constant value which describes the rows in after filtering and sorting
+ rem * phase.
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_ROWS_PHASE_AFTER_FILTER_SORT()
+ methodret "forEachNodeAfterFilterAndSort"
+ methodend
+ rem /**
+ rem * Constant value which defines that chart toolbar settings item
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString CHART_TOOLBAR_SETTINGS()
+ methodret "chartSettings"
+ methodend
+ rem /**
+ rem * Constant value which defines that chart toolbar data item
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString CHART_TOOLBAR_DATA()
+ methodret "chartData"
+ methodend
+ rem /**
+ rem * Constant value which defines that chart toolbar format item
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString CHART_TOOLBAR_FORMAT()
+ methodret "chartFormat"
+ methodend
+ rem /**
+ rem * Constant value which defines that chart toolbar download item
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString CHART_TOOLBAR_DOWNLOAD()
+ methodret "chartDownload"
+ methodend
+ rem /**
+ rem * Constant value which defines that balham theme
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_THEME_BALHAM()
+ methodret "balham"
+ methodend
+ rem /**
+ rem * Constant value which defines that balham dark theme
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_THEME_BALHAM_DARK()
+ methodret "balham-dark"
+ methodend
+ rem /**
+ rem * Constant value which defines the material theme
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_THEME_MATERIAL()
+ methodret "material"
+ methodend
+ rem /**
+ rem * Constant value which defines the alpine theme
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_THEME_ALPINE()
+ methodret "alpine"
+ methodend
+ rem /**
+ rem * Constant value which defines the alpine dark theme
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_THEME_ALPINE_DARK()
+ methodret "alpine-dark"
+ methodend
+ rem /**
+ rem * Constant value which defines the rows floating on top
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_FLOATING_TOP()
+ methodret "top"
+ methodend
+ rem /**
+ rem * Constant value which defines the rows floating on bottom
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_FLOATING_BOTTOM()
+ methodret "bottom"
+ methodend
+ rem /**
+ rem * Constant value which defines the rows with no floating
+ rem *
+ rem * @return BBjString
+ rem */
+ method public static BBjString GRID_FLOATING_NONE()
+ methodret ""
+ methodend
+ rem /**
+ rem * Make Hex Color
+ rem *
+ rem * Convert the given BBjColor to a hex color string
+ rem *
+ rem * @param BBjColor color! BBj color
+ rem *
+ rem * @return BBjString hex color
+ rem */
+ method public static BBjString makeHexColor(BBjColor color!)
+ methodret "#"+hta(chr(color!.getRed()))+hta(chr(color!.getGreen()))+hta(chr(color!.getBlue()))
+ methodend
+ rem /**
+ rem * Convert the image at the given path to base64 string
+ rem *
+ rem * @param BBjString filename! The image's path
+ rem *
+ rem * @return BBjString Image as base64 string
+ rem */
+ method public static BBjString imageToBase64(BBjString filename!)
+ imageSlice!=BBjAPI().getSysGui().getImageManager().loadImageFromFile(filename!)
+ bytes$ = str(imageSlice!.getBytes("png"))
+ b64$ = java.util.Base64.getEncoder().encode(bytes$)
+ methodret "data:image/png;base64, "+b64$
+ methodend
+ rem /**
+ rem * Alias for imageToBase64()
+ rem *
+ rem * @see imageToBase64()
+ rem */
+ method public static BBjString getImageData(BBjString filename!)
+ methodret BBjGridExWidget.imageToBase64(filename!)
+ methodend
+ rem /**
+ rem * The method will check whether the grid has license key or not.
+ rem *
+ rem * @return BBjNumber true when a license key is found, false otherwise
+ rem */
+ method public static BBjNumber isLicensed()
+ #getLicenseManager().setLicenseKey(#getLicenseKey())
+ methodret #getLicenseManager().isLicensed()
+ methodend
+ rem /**
+ rem * disabled default constructor
+ rem */
+ method public BBjGridExWidget()
+ methodend
+ rem /**
+ rem * The constructor that creates the widget on wnd!
+ rem *
+ rem * @param BBjWindow wnd!! parent window
+ rem * @param BBjNumber id! the control ID
+ rem * @param BBjNumber x! x-location
+ rem * @param BBjNumber y! y-location
+ rem * @param BBjNumber w! width
+ rem * @param BBjNumber h! height
+ rem */
+ method public BBjGridExWidget(BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h!)
+ #create(wnd!,id!,x!,y!,w!,h!,"")
+ methodend
+ rem /**
+ rem * The constructor that creates the widget on wnd!
+ rem *
+ rem * @param BBjWindow wnd!! parent window
+ rem * @param BBjNumber id! the control ID
+ rem * @param BBjNumber x! x-location
+ rem * @param BBjNumber y! y-location
+ rem * @param BBjNumber w! width
+ rem * @param BBjNumber h! height
+ rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
+ rem * By default you will never need to change the default Template.
+ rem * Unless you want to do something really unusual
+ rem */
+ method public BBjGridExWidget(BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h! , BBjString template$)
+ #create(wnd!,id!,x!,y!,w!,h!,template$)
+ methodend
+ rem /**
+ rem * The constructor that creates the widget in the ChildWindow
+ rem *
+ rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
+ rem */
+ method public BBjGridExWidget(BBjChildWindow wnd!)
+ #create(wnd!,"")
+ methodend
+ rem /**
+ rem * The constructor that creates the widget in the ChildWindow
+ rem *
+ rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
+ rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
+ rem * By default you will never need to change the default Template.
+ rem * Unless you want to do something really unusual
+ rem */
+ method public BBjGridExWidget(BBjChildWindow wnd!,BBjString template$)
+ #create(wnd!,template$)
+ methodend
+ rem /**
+ rem * Create the widget
+ rem *
+ rem * @param BBjWindow wnd!! parent window
+ rem * @param BBjNumber id! the control ID
+ rem * @param BBjNumber x! x-location
+ rem * @param BBjNumber y! y-location
+ rem * @param BBjNumber w! width
+ rem * @param BBjNumber h! height
+ rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
+ rem * By default you will never need to change the default Template.
+ rem * Unless you want to do something really unusual
+ rem *
+ rem * @Override
+ rem */
+ method protected void create(BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h!, BBjString template$)
+ #super!.setCanvas(wnd!.addChildWindow(id!,x!,y!,w!,h!,"",$00000800$,BBjAPI().getSysGui().getAvailableContext()))
+ #super!.setX(x!)
+ #super!.setY(y!)
+ #super!.setW(w!)
+ #super!.setH(h!)
+ #RS!.createIndex()
+ #fillChartToolbarItems()
+ #setTemplate(template$)
+ #redraw(BBjAPI.TRUE)
+ methodend
+ rem /**
+ rem * Create the widget
+ rem *
+ rem * @param BBjWindow wnd!! parent window
+ rem * @param BBjNumber id! the control ID
+ rem * @param BBjNumber x! x-location
+ rem * @param BBjNumber y! y-location
+ rem * @param BBjNumber w! width
+ rem * @param BBjNumber h! height
+ rem *
+ rem * @Override
+ rem */
+ method protected void create(BBjWindow wnd!, BBjNumber id!, BBjNumber x!, BBjNumber y!, BBjNumber w!, BBjNumber h!)
+ #create(wnd!,id!,x!,y!,w!,h!,"")
+ methodend
+ rem /**
+ rem * Create the widget
+ rem *
+ rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
+ rem * @param BBjString template$ The client's HTML template to use in order to build the grid.
+ rem * By default you will never need to change the default Template.
+ rem * Unless you want to do something really unusual
+ rem *
+ rem * @Override
+ rem */
+ method protected void create(BBjChildWindow wnd!,BBjString template$)
+ #super!.setCanvas(wnd!)
+ #super!.setX(wnd!.getX())
+ #super!.setY(wnd!.getY())
+ #super!.setW(wnd!.getWidth())
+ #super!.setH(wnd!.getHeight())
+ #RS!.createIndex()
+ #fillChartToolbarItems()
+ #setTemplate(template$)
+ #redraw(BBjAPI.TRUE)
+ methodend
+ rem /**
+ rem * Create the widget
+ rem *
+ rem * @param BBjChildWindow wnd!: the child window in which to create the BBjGridExWidget
+ rem * @param BBjString template$ the html template to use for the grid initialization
+ rem *
+ rem * @Override
+ rem */
+ method protected void create(BBjChildWindow wnd!)
+ #create(wnd!,"")
+ methodend
+ REM /**
+ REM * Get the unique control type
+ REM *
+ REM * @returns int controlType = 65001
+ REM */
+ method public int getControlType()
+ methodret 65001
+ methodend
+ rem /**
+ rem * Register an event handler
+ rem *
+ rem * @param Int type! The event's type
+ rem * @param String callback! The event's callback
+ rem *
+ rem * @Override
+ rem */
+ method public void setCallback(int type!, String callback!)
+ #super!.setCallback(type!,callback!)
+ #getInterests().add(type!)
+ #updateClientWithInterests()
+ methodend
+ rem /**
+ rem * Register an event handler
+ rem *
+ rem * @param Int type! The event's type
+ rem * @param CustomObject instance! class instance
+ rem * @param String method! method name
+ rem *
+ rem * @Override
+ rem */
+ method public void setCallback(int type!, CustomObject instance!, String method!)
+ #super!.setCallback(type!, instance!, method!)
+ #getInterests().add(type!)
+ #updateClientWithInterests()
+ methodend
+ rem /**
+ rem * Remove callback
+ rem *
+ rem * @param Int type! The event's type
+ rem *
+ rem * @Override
+ rem */
+ method public void clearCallback(int type!)
+ #super!.clearCallback(type!)
+ interests! = #getInterests()
+ el! = new JsonPrimitive(type!)
+
+ if(interests!.contains(el!)) then
+ interests!.remove(el!)
+ #updateClientWithInterests()
+ FI
+ methodend
+ rem /**
+ rem * Enable remote debugging on the given port
+ rem *
+ rem * @param BBjNumber debug! true to enable debug , false otherwise
+ rem * @param BBjNumber port! the debugging port
+ rem *
+ rem * @return void
+ rem */
+ method public static void setDebug(BBjNumber debug! , BBjNumber port!)
+ if(debug!.booleanValue())
+ chromiumSwitches$ = stbl("!CHROMIUM_SWITCHES","--remote-debugging-port=" + str(port!))
+ FI
+
+ #Debug! = debug!
+ methodend
+ rem /**
+ rem * Enable remote debugging on the 9222 port
+ rem *
+ rem * @param BBjNumber debug! true to enable debug , false otherwise
+ rem *
+ rem * @return void
+ rem */
+ method public static void setDebug(BBjNumber debug!)
+ #setDebug(Debug! , 9222)
+ methodend
+ rem /**
+ rem * Get the root id of the grid
+ rem *
+ rem * The root id is a unique & auto-generated id for the grid instance.
+ rem * This id is used in the client to distinguish the grid instances
+ rem *
+ rem * @return BBjString the root id
+ rem */
+ method public BBjString getRootId()
+ if(null() = #RootId!)
+ #InstanceCount! = #InstanceCount! + 1
+ #RootId! = "gx-grid-" + str(#InstanceCount!)
+ FI
+
+ methodret #RootId!
+ methodend
+ rem /**
+ rem * Return the number of initiated instances of the grid
+ rem *
+ rem * @return BBjNumber The number of instances
+ rem */
+ method public static BBjNumber getInstanceCount()
+ methodret #InstanceCount!
+ methodend
+ rem /**
+ rem * @Override
+ rem *
+ rem * This method is called whenever the widget needs to be rendered
+ rem *
+ rem * @param Boolean f_init! if TRUE then the control is rendered for the first time so this method
+ rem * has to perform initial rendering
+ rem */
+ method public void redraw(Boolean f_init!)
+ declare BBjHtmlView htmlview!
+
+ if (f_init!) then
+ rem @see https://bugzilla.basis.com/show_bug.cgi?id=33048
+ enableInternalSpecialKeysHandling! = stbl("!OPTIONS","HTMLVIEW_INTERNAL_TABS=TRUE")
+ html$ = #getTemplate()
+ htmlview! = #getCanvas().addHtmlView(101,0,0,#getCanvas().getWidth(),#getCanvas().getHeight(),"",$0000$)
+ htmlview!.setOpaque(0)
+ htmlview!.setNoEdge(1)
+ htmlview!.setTabTraversable(1)
+ htmlview!.setFocusable(1)
+ htmlview!.addStyle("htmlview-" + #getRootId())
+
+ if (info(3,6)="6" AND AND(#getCanvas().getWindowFlags(),$00100000$) = $00100000$) then
+ rem in DWC, if parent window is client-side sized, make the htmlview same size as surrunding canvas
+ htmlview!.setStyle("width","100%")
+ htmlview!.setStyle("height","100%")
+ fi
+
+ if (info(3,6)<"5" and #getDebug() > 0) then
+ url$ = htmlview!.getAttribute("remoteDebuggingURL")
+
+ if url$>"" then
+ a = scall("bbj BBjGridExWidget/util/DebugWindow.bbj - "+url$+" &")
+ FI
+ FI
+
+ htmlview!.setCallback(BBjAPI.ON_PAGE_LOADED,#this!,"onInit")
+ htmlview!.setCallback(BBjAPI.ON_NATIVE_JAVASCRIPT,#this!,"onNativeEvent")
+ htmlview!.setCallback(BBjAPI.ON_GAINED_FOCUS,#this!,"onGainedFocus")
+ htmlview!.setText(html$)
+ #HTMLView!=htmlview!
+ else
+ #HTMLView!.setSize(#getCanvas().getWidth(),#getCanvas().getHeight())
+ FI
+ methodend
+ rem /**
+ rem * Inject a js Script at the top window.
+ rem *
+ rem * If for some reason you want to inject a script in the iframe , then use the injectScript method
+ rem * from the created internal HTML View.
+ rem *
+ rem * @see BBjHtmlView::injectScript
+ rem *
+ rem * @param BBjString script! the path for the javascript file
+ rem */
+ method public void injectScript(BBjString script!)
+ #HTMLView!.injectScript(new String(script!.getBytes(),"UTF-8") , 1)
+ methodend
+ rem /**
+ rem * Execute a javascript code on the client.
+ rem *
+ rem * Note that if the grid is not ready yet , then script will queued until the grid is ready then send
+ rem * to the client.
+ rem * If some reason you do not want this behavior , then use the executeScript method from the created internal
+ rem * HTML View
+ rem *
+ rem * @see BBjHtmlView::executeScript
+ rem *
+ rem * @param BBjString script$ The javascript code
+ rem *
+ rem * @return Object returned value, if any
+ rem */
+ method public Object executeScript(BBjString script$)
+ methodret #getExecutor().execute(script$)
+ methodend
+ rem /**
+ rem * When true then the executor will limit the rate at
+ rem * which executeScript gets invoked on the HTMLView.
+ rem *
+ rem * Setting this to "0" will help to boost up the communication
+ rem * performance between BBj and the grid which lives inside
+ rem * the HTMLView in BUI context
+ rem *
+ rem * By default this options is set to "0"
+ rem *
+ rem * @param BBjNumber suppress! true to suppress , false to enable
+ rem */
+ method public void suppressBuiDebouncing(BBjNumber suppress!)
+ #getExecutor().setSuppressBuiDebouncing(suppress!)
+ methodend
+ rem /**
+ rem * When true then the executor will limit the rate at
+ rem * which executeScript gets invoked on the HTMLView.
+ rem *
+ rem * Setting this to "0" will help to boost up the communication
+ rem * performance between BBj and the grid which lives inside
+ rem * the HTMLView in GUI context
+ rem *
+ rem * By default this options is set to "1"
+ rem *
+ rem * @param BBjNumber suppress! true to suppress , false to enable
+ rem */
+ method public void suppressGuiDebouncing(BBjNumber suppress!)
+ #getExecutor().setSuppressGuiDebouncing(suppress!)
+ methodend
+ rem /**
+ rem * Suppress scripts debouncing for GUI and BUI
+ rem *
+ rem * @see #suppressBuiDebouncing()
+ rem * @see #suppressGuiDebouncing()
+ rem *
+ rem * @param BBjNumber suppress! true to suppress , false to enable
+ rem */
+ method public void suppressDebouncing(BBjNumber suppress!)
+ #suppressBuiDebouncing(suppress!)
+ #suppressGuiDebouncing(suppress!)
+ methodend
+ rem /**
+ rem * An Event listener executed after the initial load of the HTML View.
+ rem *
+ rem * At this phase the grid will inject all required js files in the client to make the grid functional.
+ rem *
+ rem * @param BBjEvent ev! The onLoad event
+ rem */
+ method public void onInit(BBjEvent ev!)
+ #HTMLView!.clearCallback(BBjAPI.ON_PAGE_LOADED)
+ isLicensed! = 0
+
+ if (#getForceCommunityBuild() = 0) then
+ isLicensed! = #isLicensed()
+ FI
+ rem /**
+ rem * work out the required js files
+ rem */
+ basePath$ = "BBjGridExWidget/client/dist"
+ agGridPath$ = iff(isLicensed!, (basePath$ + "/ag-grid-enterprise.min.js") , (basePath$ +"/ag-grid-community.min.js"))
+ gxPath$ = basePath$ + "/bbj-grid-widget.min.js"
+ rem for debugging we inject the unminified files which contain source maps of the original code
+ if #getDebug() = 1 then
+ agGridPath$ = iff(isLicensed!, (basePath$ + "/ag-grid-enterprise.js") , (basePath$ +"/ag-grid-community.js"))
+ gxPath$ = basePath$ + "/bbj-grid-widget.js"
+ FI
+ rem /**
+ rem * Bundle the content of all required scripts
+ rem */
+ scriptsSet! = new HashSet()
+ scriptsSet!.add(agGridPath$)
+ scriptsSet!.add(gxPath$)
+ rem /**
+ rem * This is the most important piece , without it the grid won't work in GUI
+ rem *
+ rem * Why?
+ rem *
+ rem * in BUI we use GWT and GWT uses $wnd instead of window because compiled code is executed normally in an iframe,
+ rem * and in this context, window will reference the iframe window while $wnd will reference the parent window.
+ rem * The same occurs with $doc which is a reference in the iframe to the parent document.
+ rem *
+ rem * All JS calls we run from the grid are executed in the $wnd context because all scripts
+ rem * are inject in the top level window
+ rem *
+ rem * In GUI there is no iframe which means theres is no $wnd or $doc , because of this all
+ rem * the JS code we execute from the grid will throw an error , we polyfill these two vars
+ rem * for GUI to get around the problem
+ rem */
+ rem bundle$ = "var $wnd = (typeof $wnd !== 'undefined' ? $wnd : window);"
+ rem bundle$ = bundle$ + "var $doc = (typeof $doc !== 'undefined' ? $doc : document);"
+ bundle$ = "var $wnd = window;"
+ bundle$ = bundle$ + "var $doc = document;"
+ rem loop over the require scripts and attach to the bundle
+ it! = scriptsSet!.iterator()
+ while(it!.hasNext())
+ path! = it!.next()
+ ch=unt
+ open (ch)path!
+ read record (ch,siz=5512000)content$
+ close (ch)
+ bundle$ = bundle$ + content$
+ wend
+ rem finally inject the built bundle
+ #injectScript(bundle$)
+ rem /**
+ rem * Some customers reported that the second ON_PAGE_LOADED event is not fired
+ rem * so we call the onLoaded method manually in case the event is not fired
+ rem *
+ rem * could even directly call the onLoaded Method from here
+ rem * #onLoaded(null())
+ rem */
+ BBjAPI().createTimer(str(#this!)+"onLoadFallback",.2,#this!,"onLoaded")
+ methodend
+ rem /**
+ rem * An Event listener executed after the second ON_PAGE_LOADED event
+ rem *
+ rem * At this phase the grid flush all enqueued scripts
+ rem *
+ rem * @param BBjEvent ev! The onLoad event
+ rem */
+ method public void onLoaded(BBjEvent ev!)
+ #HTMLView!.clearCallback(BBjAPI.ON_PAGE_LOADED)
+ BBjAPI().removeTimer(str(#this!)+"onLoadFallback",err=*next)
+ #getLicenseManager().register(#this!)
+ #IsReady! = BBjAPI.TRUE
+ #render()
+ #getExecutor().flush()
+
+ if (#newW! <> null() and #newH!<> null()) then
+ #super!.setSize(#newW!,#newH!)
+ #newW! = null()
+ #newH! = null()
+ FI
+ methodend
+ rem /**
+ rem * Focus the grid by selecting the cell in the first cell and first column.
+ rem *
+ rem * Note: If the grid has already a different selected cell , then
+ rem * the event handler will retain the selection
+ rem *
+ rem * @param BBjGainedFocusEvent ev! The focus event
+ rem */
+ method public void onGainedFocus(BBjGainedFocusEvent ev!)
+ if(ev!.isTemporary())
+ methodret
+ FI
+
+ #focus()
+ methodend
+ rem /**
+ rem * On NativeEvent
+ rem *
+ rem * Event Handler for Native JavaScript Event coming from the client
+ rem * Determines and dispatches the actual event
+ rem *
+ rem * @param BBjNativeJavaScriptEvent ev! The Javascript Event
+ rem */
+ method public void onNativeEvent(BBjNativeJavaScriptEvent ev!)
+ map! = ev!.getEventMap()
+ type$ = str(map!.get("type"))
+ detail$ = str(map!.get("detail"))
+ switch type$
+ case "gw.rowSelect"
+ #onSelectRowChange(detail$, #ON_GRID_SELECT_ROW())
+ break
+ case "gw.rowClick"
+ #onSelectRowChange(detail$,#ON_GRID_ROW_CLICK())
+ break
+ case "gw.rowDoubleClick"
+ #onSelectRowChange(detail$,#ON_GRID_DOUBLE_CLICK())
+ break
+ case "gw.cellClicked"
+ #onCellEvent(detail$,#ON_GRID_CELL_CLICK())
+ break
+ case "gw.cellDoubleClicked"
+ #onCellEvent(detail$,#ON_GRID_CELL_DOUBLE_CLICK())
+ break
+ case "gw.rangeSelection"
+ #onRangeSelectionChange(detail$)
+ break
+ case "gw.cellEditingStarted"
+ #onCellEvent(detail$,#ON_GRID_CELL_EDITING_STARTED())
+ break
+ case "gw.cellEditingStopped"
+ #onCellEvent(detail$,#ON_GRID_CELL_EDITING_STOPPED())
+ break
+ case "gw.cellValueChanged"
+ #onCellEvent(detail$,#ON_GRID_CELL_VALUE_CHANGED())
+ break
+ case "gw.rowEditingStarted"
+ #onRowEditing(detail$,#ON_GRID_ROW_EDITING_STARTED())
+ break
+ case "gw.rowEditingStopped"
+ #onRowEditing(detail$,#ON_GRID_ROW_EDITING_STOPPED())
+ break
+ case "gw.rowValueChanged"
+ #onRowEditing(detail$,#ON_GRID_ROW_VALUE_CHANGED())
+ break
+ case "gw.stateChanged"
+ #handleStateChangedEvent(detail$,#ON_GRID_STATE_CHANGE())
+ break
+ case "gw.contextmenu"
+ #onContextmenuEvent(detail$)
+ break
+ case "gw.keypress"
+ #onKeypressEvent(detail$)
+ break
+ case "gw.suggestion"
+ #onSuggestionEvent(detail$)
+ break
+ case "gw.filterChanged"
+ #onFilterChangedEvent()
+ break
+ case "gw.gridReady"
+ #onGridReadyEvent()
+ break
+ swend
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public GxColumn addColumn(GxColumn definition!)
+ methodret #getColumnsManager().addColumn(definition!)
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public GxColumn addColumn(BBjString field!,BBjNumber type!)
+ methodret #getColumnsManager().addColumn(field! , type!)
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public GxColumn addColumn(BBjString field!,BBjString label!)
+ methodret #getColumnsManager().addColumn(field! , label!)
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public GxColumn addColumn(BBjString field!, BBjString label! , BBjNumber type!)
+ methodret #getColumnsManager().addColumn(field! , label! ,type!)
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public GxColumn addColumn(BBjString field!)
+ methodret #addColumn(field!,field!)
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public GxColumn getColumn(BBjString field!)
+ methodret #getColumnsManager().getColumn(field!)
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public BBjNumber hasColumn(BBjString field!)
+ methodret #getColumnsManager().hasColumn(field!)
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public GxColumn removeColumn(BBjString field!)
+ methodret #getColumnsManager().removeColumn(field!)
+ methodend
+ rem /**
+ rem * Sets the foreground color for a column
+ rem *
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem * @param BBjString field$ The field name of the column definition
+ rem * @param BBjColor color! the color for the column
+ rem */
+ method public void setColumnForeColor(BBjString field$,BBjColor color!)
+ #getColumn(field$).setForeColor(color!)
+ methodend
+ rem /**
+ rem * Sets the foreground color for a column
+ rem *
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem * @param BBjString field$ The field name of the column definition
+ rem * @param BBjString color$ Valid CSS color
+ rem *
+ rem * @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
+ rem */
+ method public void setColumnForeColor(BBjString field$,BBjString color!)
+ #getColumn(field$).setForeColor(color!)
+ methodend
+ rem /**
+ rem * Sets the background color of a column
+ rem *
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem * @param BBjString field$ The field name of the column definition
+ rem * @param BBjColor color! The color for the column
+ rem */
+ method public void setColumnBackColor(BBjString field$,BBjColor color!)
+ #getColumn(field$).setBackColor(color!)
+ methodend
+ rem /**
+ rem * Sets the background color of a column
+ rem *
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem * @param BBjString field$ The field name of the column definition
+ rem * @param BBjColor color$ Valid CSS color
+ rem *
+ rem * @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
+ rem */
+ method public void setColumnBackColor(BBjString field$,BBjString color!)
+ #getColumn(field$).setBackColor(color!)
+ methodend
+ rem /**
+ rem * Sets the default alignment for a column
+ rem *
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem * @param BBjString field! The field name of the column definition
+ rem * @param BBjNumber align! The column alignment
+ rem *
+ rem * valid alignments:
+ rem *
+ rem * @see GRID_ALIGN_LEFT()
+ rem * @see GRID_ALIGN_CENTER()
+ rem * @see GRID_ALIGN_RIGHT()
+ rem *
+ rem * @RequiresRefresh
+ rem */
+ method public void setColumnAlignment(BBjString field!, BBjNumber align!)
+ #getColumn(field!).setAlignment(align!)
+ methodend
+ rem /**
+ rem * Sets the default alignment for a column's header
+ rem *
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem * @param BBjString field! The field name of the column definition
+ rem * @param BBjNumber align! The column's header alignment
+ rem *
+ rem * valid alignments:
+ rem *
+ rem * @see GRID_ALIGN_LEFT()
+ rem * @see GRID_ALIGN_CENTER()
+ rem * @see GRID_ALIGN_RIGHT()
+ rem *
+ rem * @RequiresRefresh
+ rem */
+ method public void setColumnHeaderAlignment(BBjString field!, BBjNumber align!)
+ #getColumn(field!).setHeaderAlignment(align!)
+ methodend
+ rem /**
+ rem * Sets the width of a column
+ rem *
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem *
+ rem * Note: Unlike setting the width in the column definition, this method will update a column width without
+ rem * a full re-render.
+ rem *
+ rem * @param BBjString field$ The field name of the column definition
+ rem * @param BBjNumber width! The column width
+ rem */
+ method public void setColumnWidth(BBjString field$, BBjNumber width!)
+ if #hasColumn(field$) then
+ #getColumn(field$).setWidth(width!)
+ scriptKey! = "$wnd.gw_setColumnWidth_" + field$
+ #getExecutor().execute(scriptKey! , "$wnd.gw_setColumnWidth('"+ #getRootId() + "','" + field$ + "'," + str(width!) + ");")
+ FI
+ methodend
+ rem /**
+ rem * Pin a column of the grid to the left or the right margin
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString field$ The field name of the column
+ rem * @param BBjString pin$ The pin direction ("right" or "left")
+ rem *
+ rem * @see GxColumn.PINNED_LEFT()
+ rem * @see GxColumn.PINNED_RIGHT()
+ rem */
+ method public void pinColumn(BBjString field$, BBjString pin$)
+ pin$=cvs(pin$,8)
+
+ if #hasColumn(field$) then
+ #getColumn(field$).setPinned(pin$)
+ scriptKey! = "$wnd.gw_pinColumn" + field$
+ #getExecutor().execute(scriptKey!,"$wnd.gw_pinColumn('" + #getRootId() + "','" + field$ + "','" + pin$ + "');")
+ FI
+ methodend
+ rem /**
+ rem * Change column position
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString field$ The field name of the column
+ rem * @param BBjNumber toIndex! The new column position/index
+ rem */
+ method public void moveColumn(BBjString Field$, BBjNumber toIndex!)
+ scriptKey! = "$wnd.gw_moveColumn" + field$
+ script$="$wnd.gw_moveColumn('" + #getRootId() + "','" + field$ + "'," + str(toIndex!) + ");"
+ #getExecutor().execute(scriptKey!,script$)
+ methodend
+ rem /**
+ rem * Set the mask of a column using value formatter expression.
+ rem *
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem *
+ rem * Note: This method will override the ValueFormatterExpression of the column.The method depends on
+ rem * the column type to determine the correct value formatter (number, date, ...)
+ rem *
+ rem ng field! The column's field
+ rem * @param BBjString mask!: The (date or numeric) mask, BBj style
+ rem */
+ method public void setColumnMask(BBjString field!, BBjString mask!)
+ if(#hasColumn(field!)) then
+ #getColumn(field!).setColumnMask(mask!)
+ FI
+ methodend
+ rem /**
+ rem * Set an image list for a given column using GxRendererImageRenderer.
+ rem *
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem *
+ rem * Note: This method will override the CellRenderer of the column.
+ rem * The column has to contain the values "1","2","3" to x to reference the slices in the BBjImage list
+ rem *
+ rem * @param BBjString field! The column's field
+ rem * @param BBjImage imagelist! The image list containing the image sprites
+ rem */
+ method public void setColumnImageList(BBjString field!, BBjImage imagelist!)
+ if #hasColumn(field!) then
+ renderer! = new GxRendererImageRenderer()
+ enc! = java.util.Base64.getEncoder()
+ for i=1 to int(imageList!.getWidth() / imageList!.getHeight())
+ imageSlice!=imageList!.getImageSlice(i-1,imageList!.getHeight())
+ bytes$ = imageSlice!.getBytes("png")
+ b64$ = enc!.encode(bytes$)
+ renderer!.getList().addProperty(str(i-1),"data:image/png;base64, "+b64$)
+ next
+ rem adding a clear pixel to reflect the -1 for backwards compatibility to legacy BBj grid
+ clearpixel$=enc!.encode($89504E470D0A1A0A0000000D4948445200000001000000010804000000B51C0C020000000B49444154789C63FACF0000020701029A1C31710000000049454E44AE426082$)
+ renderer!.getList().addProperty("-1","data:image/png;base64, "+clearpixel$)
+ #getColumn(field!).setCellRenderer(renderer!)
+ FI
+ methodend
+ rem /**
+ rem * Set an aggregation function for the passed column field
+ rem *
+ rem *
#Enterprise
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem * @param BBjString field! The column's field
+ rem * @param BBjString AggFunc! Name of function to use for aggregation. One of [sum,min,max,first,last].
+ rem */
+ method public void setColumnAggFunc(BBjString field! , BBjString AggFunc!)
+ if(#hasColumn(field!)) then
+ #getColumn(field!).setAggFunc(AggFunc!)
+ FI
+ methodend
+ rem /**
+ rem * Enable row grouping for columns
+ rem *
+ rem *
#Enterprise
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! A comma separated string of column fields
+ rem */
+ method public void addRowGroupColumns(BBjString columns!)
+ #getExecutor().execute("$wnd.gw_addRowGroupColumn('" + #getRootId() + "','" + columns! + "', 0 );")
+ list! = Arrays.asList(columns!.split(","))
+ it! = list!.iterator()
+ count! = 0
+ WHILE (it!.hasNext())
+ next! = #getColumn(cvs(it!.next(),128))
+ next!.setRowGroup(1)
+ next!.setEnableRowGroup(1)
+ next!.setRowGroupIndex(count!)
+ count! = count! + 1
+ WEND
+ methodend
+ rem /**
+ rem * Disable row grouping for all columns and enable it for the passed columns
+ rem *
+ rem *
#Enterprise
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! A comma separated string of column fields
+ rem */
+ method public void setRowGroupColumns(BBjString columns!)
+ #getExecutor().execute("$wnd.gw_addRowGroupColumn('" + #getRootId() + "','" + columns! + "' , 1);")
+ list! = Arrays.asList(columns!.split(","))
+ it! = #getColumnsManager().getColumns().entrySet().iterator()
+ count! = 0
+ WHILE (it!.hasNext())
+ next! = cast(GxColumn , it!.next().getValue())
+
+ if(list!.contains(next!.getField())) then
+ next!.setRowGroup(1)
+ next!.setEnableRowGroup(1)
+ next!.setRowGroupIndex(count!)
+ count! = count! + 1
+ else
+ next!.setRowGroup(0)
+ next!.setEnableRowGroup(0)
+ next!.setRowGroupIndex(null())
+ FI
+ WEND
+ methodend
+ rem /**
+ rem * Disable row grouping for columns.
+ rem *
+ rem *
#Enterprise
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! A comma separated string of column fields
+ rem */
+ method public void removeRowGroupColumns(BBjString columns!)
+ #getExecutor().execute("$wnd.gw_removeRowGroupColumn('" + #getRootId() + "','" + columns! + "');")
+ list! = Arrays.asList(columns!.split(","))
+ it! = list!.iterator()
+ WHILE (it!.hasNext())
+ next! = #getColumn(cvs(it!.next(),128))
+ next!.setRowGroup(0)
+ next!.setEnableRowGroup(0)
+ next!.setRowGroupIndex(null())
+ WEND
+ methodend
+ rem /**
+ rem * Enable pivot for columns
+ rem *
+ rem *
#Enterprise
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! A comma separated string of column fields
+ rem */
+ method public void addPivotColumns(BBjString columns!)
+ #getExecutor().execute("$wnd.gw_addPivotColumns('" + #getRootId() + "','" + columns! + "', 0 );")
+ list! = Arrays.asList(columns!.split(","))
+ it! = list!.iterator()
+ count! = 0
+ WHILE (it!.hasNext())
+ next! = #getColumn(cvs(it!.next(),128))
+ next!.setEnablePivot(1)
+ next!.setPivotIndex(count!)
+ count! = count! + 1
+ WEND
+ methodend
+ rem /**
+ rem * Disable pivot for all columns and enable it for the passed columns
+ rem *
+ rem *
#Enterprise
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! A comma separated string of column fields
+ rem */
+ method public void setPivotColumns(BBjString columns!)
+ #getExecutor().execute("$wnd.gw_addPivotColumns('" + #getRootId() + "','" + columns! + "' , 1);")
+ list! = Arrays.asList(columns!.split(","))
+ it! = #getColumnsManager().getColumns().entrySet().iterator()
+ count! = 0
+ WHILE (it!.hasNext())
+ next! = cast(GxColumn , it!.next().getValue())
+
+ if(list!.contains(next!.getField())) then
+ next!.setEnablePivot(1)
+ next!.setPivotIndex(count!)
+ count! = count! + 1
+ else
+ next!.setEnablePivot(0)
+ next!.setPivotIndex(null())
+ FI
+ WEND
+ methodend
+ rem /**
+ rem * Disable pivot for columns.
+ rem *
+ rem *
#Enterprise
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! A comma separated string of column fields
+ rem */
+ method public void removePivotColumns(BBjString columns!)
+ #getExecutor().execute("$wnd.gw_removePivotColumns('" + #getRootId() + "','" + columns! + "');")
+ list! = Arrays.asList(columns!.split(","))
+ it! = list!.iterator()
+ WHILE (it!.hasNext())
+ next! = #getColumn(cvs(it!.next(),128))
+ next!.setEnablePivot(0)
+ next!.setPivotIndex(null())
+ WEND
+ methodend
+ rem /**
+ rem * Enable value for columns
+ rem *
+ rem *
#Enterprise
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! A comma separated string of column fields
+ rem */
+ method public void addValueColumns(BBjString columns!)
+ #getExecutor().execute("$wnd.gw_addValueColumns('" + #getRootId() + "','" + columns! + "');")
+ list! = Arrays.asList(columns!.split(","))
+ it! = list!.iterator()
+ WHILE (it!.hasNext())
+ next! = cvs(it!.next(),128)
+ #getColumn(next!).setEnableValue(1)
+ WEND
+ methodend
+ rem /**
+ rem * Disable value for columns.
+ rem *
+ rem *
#Enterprise
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! A comma separated string of column fields
+ rem */
+ method public void removeValueColumns(BBjString columns!)
+ #getExecutor().execute("removeValueColumns('" + #getRootId() + "','" + columns! + "');")
+ list! = Arrays.asList(columns!.split(","))
+ it! = list!.iterator()
+ WHILE (it!.hasNext())
+ next! = cvs(it!.next(),128)
+ #getColumn(next!).setEnableValue(0)
+ WEND
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public GxColumnGroup addColumnGroup(GxColumnGroup definition!)
+ methodret #getColumnsManager().addColumnGroup(definition!)
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public GxColumnGroup addColumnGroup(BBjString id!)
+ methodret #getColumnsManager().addColumnGroup(id!)
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public GxColumnGroup addColumnGroup(BBjString id! , BBjString label!)
+ methodret #getColumnsManager().addColumnGroup(id!,label!)
+ methodend
+ rem /**
+ rem * Add column group
+ rem *
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem * @param BBjString id! The group id
+ rem * @param BBjString label! The group label/name
+ rem * @param BBjVector columns! Vector of columns ids/fields to use
+ rem * @param BBjNumber marryChildren! Set to 'true' to keep columns in this group beside each other in the grid.
+ rem * Moving the columns outside of the group (and hence breaking the group) is not allowed.
+ rem * @param BBjString headerClass! A CSS class to apply
+ rem *
+ rem * @return GxColumnGroup The GxColumnGroup instance
+ rem */
+ method public GxColumnGroup addColumnGroup(BBjString id! , BBjString label! , BBjVector columns! , BBjNumber marryChildren! ,BBjString headerClass! )
+ declare GxColumnGroup definition!
+
+ definition! = new GxColumnGroup(id! , label!)
+ definition!.setMarryChildren(marryChildren!)
+ definition!.getHeaderClass().add(headerClass!)
+ columnsLength! = columns!.size() - 1
+ FOR i = 0 TO columnsLength!
+ current$ = columns!.get(i)
+ column! = null()
+
+ if(#hasColumn(current$)) then
+ column! = #getColumn(current$)
+ else
+ column! = #addColumn(current$,current$)
+ FI
+
+ definition!.addColumn(column!)
+ #removeColumn(current$)
+ NEXT i
+
+ methodret #addColumnGroup(definition!)
+ methodend
+ rem /**
+ rem * Group Vector of Columns
+ rem *
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem * @param BBjString id! The group id
+ rem * @param BBjString label! The group label/name
+ rem * @param BBjVector columns! Vector of columns ids/fields to use
+ rem * @param BBjNumber marryChildren! Set to 'true' to keep columns in this group beside each other in the grid.
+ rem * Moving the columns outside of the group (and hence breaking the group) is not allowed.
+ rem *
+ rem * @return GxColumnGroup The GxColumnGroup instance
+ rem */
+ method public GxColumnGroup addColumnGroup(BBjString id!, BBjString label! , BBjVector columns! , BBjNumber marryChildren!)
+ methodret #addColumnGroup(id!,label!,columns! , marryChildren! , "" )
+ methodend
+ rem /**
+ rem * Group Vector of Columns
+ rem *
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem * @param BBjString id! The group id
+ rem * @param BBjString name! The group label/name
+ rem * @param BBjVector columns! Vector of columns ids/fields to use
+ rem *
+ rem * @return GxColumnGroup The GxColumnGroup instance
+ rem */
+ method public GxColumnGroup addColumnGroup(BBjString id! , BBjString label!, BBjVector columns!)
+ methodret #addColumnGroup(id!,label! , columns! , 1 , "" )
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public GxColumnGroup getColumnGroup(BBjString id!)
+ methodret #getColumnsManager().getColumnGroup(id!)
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public BBjNumber hasColumnGroup(BBjString id!)
+ methodret #getColumnsManager().hasColumnGroup(id!)
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public GxColumnGroup removeColumnGroup(BBjString id!)
+ methodret #getColumnsManager().removeColumnGroup(id!)
+ methodend
+ rem /**
+ rem * {@inheritDoc}
+ rem */
+ method public void resetAllColumns()
+ #getColumnsManager().resetAllColumns()
+ methodend
+ rem /**
+ rem * Alias for resetAllColumns()
+ rem *
+ rem *
#Configuration
+ rem *
#ColumnsRenderer
+ rem *
+ rem * @see resetAllColumns()
+ rem */
+ method public void clearColumnDefinitions()
+ #resetAllColumns()
+ methodend
+ rem /**
+ rem * Build the grid json configuration object
+ rem *
+ rem * @return JsonObject The grid options as JsonObject
+ rem */
+ method public JsonObject getAsJsonObject()
+ REM build the column definition
+ iterator! = #getColumnsManager().getColumns().entrySet().iterator()
+ cdef! = new JsonArray()
+ while iterator!.hasNext()
+ next! = iterator!.next()
+ key! = next!.getKey()
+ value! = next!.getValue()
+ cdef!.add(value!.getAsJsonObject())
+ wend
+
+ options! = #getOptions().getAsJsonObject()
+ rem Columns options
+ rem ===========================
+ options!. add("columnDefs",cdef!)
+ rem Context
+ rem ===========================
+ context! = options!.get("context").getAsJsonObject()
+ context!.addProperty("id",#getRootId())
+ context!. add("interests",iff(#getInterests().size() <> 0 ,#getInterests(), listIsEmpty!) ,err=*next)
+ context!.addProperty("getRowNodeId",#RowNodeId$, err=*next)
+
+ if(#getOptions().getEnableCharts() <> null() and #getOptions().getEnableCharts() = 1) then
+ context!.add("chartToolbarItems",#getChartToolbarItems(), err=*next)
+ FI
+
+ methodret options!
+ methodend
+ rem /**
+ rem * Render the grid
+ rem *
+ rem * The method will compose the grid config and send it to the client for a full re-render.
+ rem * You can use this method to force the client render after you update a setup configuration (ex: column definitions)
+ rem */
+ method public void render()
+ isWidgetReady! = #getIsReady()
+ rem /**
+ rem * Make sure to delay rendering until the widget is declared ready
+ rem *
+ rem * The widget is declared ready when the HTMLView fires the ON_PAGE_LOADED
+ rem * event and the scripts are injected successfully
+ rem */
+ if(!isWidgetReady!)
+ methodret
+ FI
+
+ isFirstRender! = #getIsFirstRender()
+ gson! = new Gson()
+ options! = #getAsJsonObject()
+ data$ = #getRS().toJson(1 , #getRowNodeId())
+ rem /**
+ rem * The script priority is defined based on isFirstRender
+ rem *
+ rem * When the grid is rendering for the first time , we make sure
+ rem * that the init script is the first one in the queue before any
+ rem * other script. if is not the first render , then the init
+ rem * is queued in the normal order.
+ rem */
+ priority! = 0
+
+ if(!isFirstRender!)
+ priority! = null()
+ FI
+
+ #getExecutor().execute("$wnd.gw_init(" + gson!.toJson(options!) + ",'" + #LicenseKey$ + "'," + data$ + ")" , 1 , priority!)
+ rem /**
+ rem * Update the IsFirstRender flag once and only once
+ rem */
+ if(!isFirstRender!)
+ #setIsFirstRender(BBjAPI.FALSE)
+ FI
+ methodend
+ rem /**
+ rem * Re-render the column definitions on the client.
+ rem *
+ rem *
#API
+ rem *
+ rem * The method will collect the new changes in columns and column groups and force the client to reflect the
+ rem * change.
+ rem */
+ method public void updateColumns()
+ definition! = #getAsJsonObject().get("columnDefs").getAsJsonArray()
+ scriptKey! = "$wnd.gw_setColumnDefinitions"
+ #getExecutor().execute(scriptKey!,"$wnd.gw_setColumnDefinitions('" + #getRootId() + "'," + new Gson().toJson(definition!) + ")")
+ methodend
+ rem /**
+ rem * Set a result set of pinned rows on top
+ rem *
+ rem * @param ResultSet rs! A ResultSet instance
+ rem */
+ method public void setPinnedTopRows(ResultSet rs!)
+ #getOptions().setPinnedTopRows(rs!)
+
+ if(#getIsReady())
+ #getExecutor().execute("$wnd.gw_setPinnedTopRowData('" + #getRootId() + "'," + #getOptions().getPinnedTopRowsAsJson() + ")")
+ fi
+ methodend
+ rem /**
+ rem * Get the pinned top rows as defined in the grid options
+ rem *
+ rem * @return ResultSet The pinned rows
+ rem */
+ method public ResultSet getPinnedTopRows()
+ methodret #getOptions().getPinnedTopRows()
+ methodend
+ rem /**
+ rem * Get the count of pinned rows on top
+ rem *
+ rem * @param BBjNumber rows count
+ rem */
+ method public BBjNumber getPinnedTopRowsCount()
+ rs! = #getOptions().getPinnedTopRows()
+ count! = 0
+
+ if(rs! <> null())
+ count! = rs!.count()
+ fi
+
+ methodret count!
+ methodend
+ rem /**
+ rem * Set a result set of pinned rows on bottom
+ rem *
+ rem * @param ResultSet rs! A ResultSet instance
+ rem */
+ method public void setPinnedBottomRows(ResultSet rs!)
+ #getOptions().setPinnedBottomRows(rs!)
+
+ if(#getIsReady())
+ #getExecutor().execute("$wnd.gw_setPinnedBottomRowData('" + #getRootId() + "'," + #getOptions().getPinnedBottomRowsAsJson() + ")")
+ fi
+ methodend
+ rem /**
+ rem * Get the pinned bottom rows as defined in the grid options
+ rem *
+ rem * @return ResultSet The pinned rows
+ rem */
+ method public ResultSet getPinnedBottomRows()
+ methodret #getOptions().getPinnedBottomRows()
+ methodend
+ rem /**
+ rem * Get the count of pinned rows on bottom
+ rem *
+ rem * @param BBjNumber rows count
+ rem */
+ method public BBjNumber getPinnedBottomRowsCount()
+ rs! = #getOptions().getPinnedBottomRows()
+ count! = 0
+
+ if(rs! <> null())
+ count! = rs!.count()
+ fi
+
+ methodret count!
+ methodend
+ rem /**
+ rem * Build the column definitions from the passed ResultSet
+ rem *
+ rem * @param ResultSet rs! ResultSet with the data
+ rem *
+ rem * @param BBjNumber addAll! When true, We will create a column definition for every column in the ResultSet, otherwise update the existing ones only
+ rem */
+ method public void buildColumnsFromResultSet(ResultSet rs! , BBjNumber addAll!)
+ if rs! <> NULL() then
+ fields! = rs!.getColumnNames()
+ iterator! = fields!.iterator()
+ while iterator!.hasNext()
+ field$ = iterator!.next()
+ meta! = rs!.getColumnMetaData(field$)
+
+ if #hasColumn(field$) = 1 then
+ #getColumn(field$).update(meta! , #getOptions().getDefaultColumnDefinition())
+ else
+ if(addAll! = 1) then
+ definition! = new GxColumn(field$)
+ definition!.update(meta!, #getOptions().getDefaultColumnDefinition())
+ #addColumn(definition!)
+ FI
+ FI
+ wend
+ FI
+ methodend
+ rem /**
+ rem * Feed the grid with data
+ rem *
+ rem * @param ResultSet rs! ResultSet with the data
+ rem * @param BBjNumber render! When true the grid will render directly on the client, otherwise you need to call render() directly
+ rem * @param BBjNumber addAll! When true, We will create a column definition for every column in the ResultSet, otherwise update the existing ones only
+ rem * @param BBjString indexdBy$ The field used for creating the unique row index
+ rem *
+ rem * @see render()
+ rem */
+ method public void setData(ResultSet rs!,BBjNumber render! , BBjNumber addAll! , BBjString indexdBy$)
+ #RowNodeId$ = indexdBy$
+ #RS! = rs!
+
+ if rs! <> NULL() then
+ #buildColumnsFromResultSet(rs!,addAll!)
+ #RS!.createIndex()
+ FI
+
+ #render()
+ methodend
+ rem /**
+ rem * Feed the grid with data
+ rem *
+ rem * The method will sync the result set column definitions with the current column definitions ,
+ rem * update the data and render the grid on the client
+ rem *
+ rem * @param ResultSet rs! ResultSet with the data
+ rem * @param BBjNumber render! When true the grid will render directly on the client, otherwise you need to call render() directly
+ rem * @param BBjNumber addAll! When true, We will create a column definition for every column in the ResultSet, otherwise update the existing ones only
+ rem *
+ rem * @see render()
+ rem */
+ method public void setData( ResultSet rs! , BBjNumber render!, BBjNumber all!)
+ #setData(rs! , render! , all! , #getRowNodeId())
+ methodend
+ rem /**
+ rem * Feed the grid with data
+ rem *
+ rem * The method will sync the result set column definitions with the current column definitions ,
+ rem * update the data and render the grid on the client
+ rem *
+ rem * @param ResultSet rs! ResultSet with the data
+ rem * @param BBjNumber render! When true the grid will render directly on the client, otherwise you need to call render() directly
+ rem *
+ rem * @see render()
+ rem */
+ method public void setData( ResultSet rs! , BBjNumber render!)
+ #setData(rs! , render! , 1 , #getRowNodeId())
+ methodend
+ rem /**
+ rem * Feed the grid with data
+ rem *
+ rem * @param ResultSet rs! ResultSet with the data
+ rem * @param BBjString indexdBy$ The field used for creating the unique row index
+ rem */
+ method public void setData(ResultSet rs!, BBjString indexdBy$)
+ #setData(rs! , 1 , 1 , indexdBy$)
+ methodend
+ rem /**
+ rem * Feed the grid with data
+ rem *
+ rem * The method will sync the result set column definitions with the current column definitions ,
+ rem * update the data and render the grid on the client
+ rem *
+ rem * @param ResultSet rs! ResultSet with the data
+ rem */
+ method public void setData( ResultSet rs!)
+ #setData(rs! , 1)
+ methodend
+ rem /**
+ rem * Feed the grid with a new ResultSet
+ rem *
+ rem * Unlike the setData method, this one will update the grid with a new rows set(ResultSet) without doing a full re-render.
+ rem * The column definition will not be synced from the passed ResultSet in this case.
+ rem *
+ rem * Use this method in case you want to replace the whole data in the grid at once.
+ rem * Please note that All row and range selection will be lost.
+ rem *
+ rem *
#API
+ rem *
+ rem * @param ResultSet rs! ResultSet with the data
+ rem *
+ rem * @see setData()
+ rem */
+ method public void updateData(ResultSet rs!)
+ #RS! = rs!
+
+ if rs! <> NULL() AND rs!.size() > 0 then
+ #RS!.createIndex(err=*next)
+ data$=#RS!.toJson(BBjAPI.TRUE,#getRowNodeId())
+ scriptKey! = "$wnd.gw_setRowData"
+ #getExecutor().execute(scriptKey!,"$wnd.gw_setRowData('" + #getRootId() + "'," + data$+ ")")
+ FI
+ methodend
+ rem /**
+ rem * Feed the grid with a new ResultSet
+ rem *
+ rem * Unlike the setData method, this one will update the grid with a new rows set(ResultSet) without doing a full re-render.
+ rem * The column definition will not be synced from the passed ResultSet in this case.
+ rem *
+ rem * Use this method in case you want to replace the whole data in the grid at once.
+ rem * Please note that All row and range selection will be lost.
+ rem *
+ rem *
#API
+ rem *
+ rem * @param ResultSet rs! ResultSet with the data
+ rem *
+ rem * @see setData()
+ rem *
+ rem * @deprecated since version 0.101.0, BBjGridExWidget.setRowsData(ResultSet rs!) is deprecated / renamed. Use BBjGridExWidget.updateData(ResultSet rs!) instead.
+ rem */
+ method public void setRowsData(ResultSet rs!)
+ GxLogger.warn("since version 0.101.0, BBjGridExWidget.setRowsData(ResultSet rs!) is deprecated / renamed. Use BBjGridExWidget.updateData(ResultSet rs!) instead.")
+ #updateData(rs!)
+ methodend
+ rem /**
+ rem * Execute a bulk update on the grid
+ rem *
+ rem * The transaction method is to pass a transaction object to the grid containing
+ rem * rows to add, remove and update.
+ rem *
+ rem * The grid keeps all active sorting, grouping and filtering, including updating to reflect
+ rem * the changes in the data should the sorting, grouping or filtering be impacted.
+ rem *
+ rem * Updating using transactions is the best way to do large updates to the grid, as the grid treats them
+ rem * as delta changes, so the grid only refreshes what is needed giving a performance boost.
+ rem *
+ rem * All row and range selection will be kept.
+ rem *
+ rem * Note that all update done on the grid will reflected also on the ResultSet instance which is the grid
+ rem * is using.
+ rem *
+ rem *
#API
+ rem *
+ rem * @param GxClientTransactionModel transaction!
+ rem * @param BBjNumber batchUpdate! when true then execute the update, along with any other updates you subsequently provide
+ rem */
+ method public void executeUpdateTransaction(GxClientTransactionModel transaction!,BBjNumber batchUpdate!)
+ transaction!.setWidget(#this!)
+ json! = transaction!.execute()
+ #getExecutor().execute("$wnd.gw_updateRowData('" + #getRootId() + "'," + json!.toString() + "," + str(batchUpdate!.booleanValue()) + ")")
+ methodend
+ rem /**
+ rem * Execute a bulk update on the grid
+ rem *
+ rem * The transaction method is to pass a transaction object to the grid containing
+ rem * rows to add, remove and update.
+ rem *
+ rem * The grid keeps all active sorting, grouping and filtering, including updating to reflect
+ rem * the changes in the data should the sorting, grouping or filtering be impacted.
+ rem *
+ rem * Updating using transactions is the best way to do large updates to the grid, as the grid treats them
+ rem * as delta changes, so the grid only refreshes what is needed giving a performance boost.
+ rem *
+ rem * All row and range selection will be kept.
+ rem *
+ rem * Note that all update done on the grid will reflected also on the ResultSet instance which is the grid
+ rem * is using.
+ rem *
+ rem *
#API
+ rem *
+ rem * @param GxClientTransactionModel transaction!
+ rem */
+ method public void executeUpdateTransaction(GxClientTransactionModel transaction!)
+ #executeUpdateTransaction(transaction! , 0)
+ methodend
+ rem /**
+ rem * Update row data
+ rem *
+ rem *
#API
+ rem *
+ rem * @param DataRow row! DataRow object which contains the update
+ rem *
+ rem * @return GxClientTransactionModel the transaction object which used to achieve the update
+ rem */
+ method public GxClientTransactionModel updateRow(DataRow row!)
+ transaction! = new GxClientTransactionModel()
+ transaction!.update(row!)
+ #executeUpdateTransaction(transaction!)
+ methodret transaction!
+ methodend
+ rem /**
+ rem * Update row data
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber index! The Row index
+ rem * @param DataRow row! DataRow object which contains the update
+ rem *
+ rem * @return GxClientTransactionModel the transaction object which used to achieve the update
+ rem *
+ rem * @deprecated since version 0.101.0, BBjGridExWidget.updateRow(BBjNumber index!,DataRow row!) is deprecated. Use BBjGridExWidget.updateRow(DataRow row!) instead. The grid can work out the row index by its own
+ rem */
+ method public GxClientTransactionModel updateRow(BBjNumber index!,DataRow row!)
+ GxLogger.warn("since version 0.101.0, BBjGridExWidget.updateRow(BBjNumber index!,DataRow row!) is deprecated. Use BBjGridExWidget.updateRow(DataRow row!) instead. The grid can work out the row index by its own")
+ methodret #updateRow(row!)
+ methodend
+ rem /**
+ rem * Update row data
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber index! The Row index
+ rem * @param DataRow row! DataRow object which contains the update
+ rem *
+ rem * @return GxClientTransactionModel the transaction object which used to achieve the update
+ rem *
+ rem * @deprecated since version 0.101.0, BBjGridExWidget.setRowData(BBjNumber index!,DataRow row!) is deprecated. Use BBjGridExWidget.updateRow(DataRow row!) instead. The grid can work out the row index by its own
+ rem */
+ method public GxClientTransactionModel setRowData(BBjNumber index!,DataRow row!)
+ GxLogger.warn("since version 0.101.0, BBjGridExWidget.setRowData(BBjNumber index!,DataRow row!) is deprecated. Use BBjGridExWidget.updateRow(DataRow row!) instead. The grid can work out the row index by its own")
+ methodret #updateRow(index!,row!)
+ methodend
+ rem /**
+ rem * Update row data
+ rem *
+ rem *
#API
+ rem *
+ rem * @param DataRow row! DataRow object which contains the update
+ rem *
+ rem * @return GxClientTransactionModel the transaction object which used to achieve the update
+ rem *
+ rem * @deprecated since version 0.101.0, BBjGridExWidget.setRowData(DataRow row!) is deprecated. Use BBjGridExWidget.updateRow(DataRow row!) instead. The grid can work out the row index by its own
+ rem */
+ method public GxClientTransactionModel setRowData(DataRow row!)
+ GxLogger.warn("since version 0.101.0, BBjGridExWidget.setRowData(DataRow row!) is deprecated. Use BBjGridExWidget.updateRow(DataRow row!) instead. The grid can work out the row index by its own")
+ methodret #updateRow(row!)
+ methodend
+ rem /**
+ rem * Add new row
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber index! The insert index
+ rem * @param DataRow row! DataRow object which contains the update
+ rem *
+ rem * @return GxClientTransactionModel the transaction object which used to achieve the update
+ rem */
+ method public GxClientTransactionModel addRow(BBjNumber index!,DataRow row!)
+ transaction! = new GxClientTransactionModel()
+ transaction!.add(row!)
+ transaction!.setAddIndex(index!)
+ #executeUpdateTransaction(transaction!)
+ methodret transaction!
+ methodend
+ rem /**
+ rem * Add new row at the beginning of the grid
+ rem *
+ rem *
#API
+ rem *
+ rem * @param DataRow row! The DataRow object which contains the update
+ rem *
+ rem * @return GxClientTransactionModel the transaction object which used to achieve the update
+ rem */
+ method public GxClientTransactionModel addRow(DataRow row!)
+ methodret #addRow(0,row!)
+ methodend
+ rem /**
+ rem * Remove a row from grid by the row reference
+ rem *
+ rem *
#API
+ rem *
+ rem * @param DataRow row! The data row object to remove
+ rem *
+ rem * @return GxClientTransactionModel the transaction object which used to achieve the update
+ rem */
+ method public GxClientTransactionModel removeRow(DataRow row!)
+ transaction! = new GxClientTransactionModel()
+ transaction!.remove(row!)
+ #executeUpdateTransaction(transaction!)
+ methodret transaction!
+ methodend
+ rem /**
+ rem * Remove a row from grid by index
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber index! The row index
+ rem *
+ rem * @return GxClientTransactionModel the transaction object which used to achieve the update
+ rem */
+ method public GxClientTransactionModel removeRow(BBjNumber index!)
+ methodret #removeRow(#getRS().get(index!))
+ methodend
+ rem /**
+ rem * Remove a row from grid by key
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString key! The row key
+ rem *
+ rem * @return GxClientTransactionModel the transaction object which used to achieve the update
+ rem */
+ method public GxClientTransactionModel removeRow(BBjString key!)
+ methodret #removeRow(#getRS().get(key!))
+ methodend
+ rem /**
+ rem * Clear row data (Empty the grid )
+ rem *
+ rem *
#API
+ rem */
+ method public void clearData()
+ #getRS().clear()
+
+ if(#IsReady!) then
+ #getExecutor().execute("$wnd.gw_setRowData('" + #getRootId() + "', [])",0)
+ fi
+ methodend
+ rem /**
+ rem * Clear row data (Empty the grid )
+ rem *
+ rem *
#API
+ rem *
+ rem * @deprecated since version 0.101.0, BBjGridExWidget.clearRowsData() is deprecated / renamed. Use BBjGridExWidget.clearData() instead.
+ rem */
+ method public void clearRowsData()
+ GxLogger.warn("since version 0.101.0, BBjGridExWidget.clearRowsData() is deprecated / renamed. Use BBjGridExWidget.clearData() instead.")
+ #clearData()
+ methodend
+ rem /**
+ rem * Apply the grid's columns , sorbing and filtering state
+ rem *
+ rem *
#API
+ rem *
+ rem * @param GxState state! : the state object
+ rem */
+ method public void setState(GxState state!)
+ scriptKey! = "$wnd.gw_setState"
+ #getExecutor().execute(scriptKey!,"$wnd.gw_setState('" + #getRootId() + "'," + state!.toString() +")")
+ methodend
+ rem /**
+ rem * Apply the grid's columns , sorbing and filtering state
+ rem *
+ rem *
#API
+ rem *
+ rem * @param GxState state! : the state object
+ rem *
+ rem * @deprecated since version 0.101.0, BBjGridExWidget.setColumnState(GxState state!) is deprecated / renamed. Use BBjGridExWidget.setState(GxState state!) instead.
+ rem */
+ method public void setColumnState(GxState state!)
+ GxLogger.warn("since version 0.101.0, BBjGridExWidget.setColumnState(GxState state!) is deprecated / renamed. Use BBjGridExWidget.setState(GxState state!) instead.")
+ #setState(state!)
+ methodend
+ rem /**
+ rem * Get the grid's columns , sorting and filtering state
+ rem *
+ rem *
#API
+ rem *
+ rem * @returns GxState
+ rem */
+ method public GxState getState()
+ state! = new GxState()
+ json_string$ = str(#getExecutor().execute("$wnd.gw_getState('" + #getRootId() + "')",0))
+ state!.setString(json_string$)
+ methodret state!
+ methodend
+ rem /**
+ rem * Get the grid's columns , sorting and filtering state
+ rem *
+ rem *
#API
+ rem *
+ rem * @returns GxState
+ rem *
+ rem * @deprecated since version 0.101.0, BBjGridExWidget.getColumnState() is deprecated / renamed. Use BBjGridExWidget.getState() instead.
+ rem */
+ method public GxState getColumnState()
+ GxLogger.warn("since version 0.101.0, BBjGridExWidget.getColumnState() is deprecated / renamed. Use BBjGridExWidget.getState() instead.")
+ methodret #getState()
+ methodend
+ rem /**
+ rem * Get the grid sidebar instance
+ rem *
+ rem * @return GxSidebar
+ rem */
+ method public GxSidebar getSidebar()
+ methodret #getOptions().getSidebar()
+ methodend
+ rem /**
+ rem * Get the language manager instance
+ rem *
+ rem * @returns GxLanguageManager
+ rem */
+ method public GxLanguageManager getLanguageManager()
+ methodret #getOptions().getLanguageManager()
+ methodend
+ rem /**
+ rem * Get the grid statusbar instance
+ rem *
+ rem * @return GxStatusBar
+ rem */
+ method public GxStatusBar getStatusbar()
+ methodret #getOptions().getStatusbar()
+ methodend
+ rem /**
+ rem * Get the grid default context menu
+ rem *
+ rem * @return GxContextMenu
+ rem */
+ method public GxContextMenu getContextMenu()
+ methodret #getOptions().getContextMenu()
+ methodend
+ rem /**
+ rem * Get the grid's client context
+ rem *
+ rem * @return JsonObject
+ rem */
+ method public JsonObject getClientContext()
+ methodret #getOptions().getClientContext()
+ methodend
+ rem /**
+ rem * Get instance of GxClientJsonFactory
+ rem *
+ rem * @return GxClientJsonFactory
+ rem */
+ method public GxClientJsonFactory getClientJsonFactory()
+ methodret #ClientJsonFactory!
+ methodend
+ rem /**
+ rem * Add Style block
+ rem *
+ rem *
#API
+ rem *
+ rem * @param selector$ : Css Selector
+ rem * @param rules! : Css Rules object as json object
+ rem */
+ method public void addStyle(BBjString selector$ , JsonObject rules! )
+ #getExecutor().execute("$wnd.gw_setStyle('" + selector$ + "','" + rules!.toString() + "')")
+ methodend
+ rem /**
+ rem * Add Style block
+ rem *
+ rem *
#API
+ rem *
+ rem * @param selector$ : Css Selector
+ rem * @param rules! : Css Rules object as string
+ rem */
+ method public void addStyle(BBjString selector$ , BBjString rules! )
+ #getExecutor().execute("$wnd.gw_setStyle('" + selector$ + "','" + rules! + "')")
+ methodend
+ rem /**
+ rem * Remove Style Block
+ rem *
+ rem *
#API
+ rem *
+ rem * @param selector$ : Css Selector
+ rem */
+ method public Boolean removeStyle(BBjString selector$)
+ #getExecutor().execute("$wnd.gw_removeStyle('" + selector$ + "')")
+ methodret BBjAPI.TRUE
+ methodend
+ rem /**
+ rem * Set the grid theme
+ rem *
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @param BBjString theme$
+ rem *
+ rem * @see getThemes()
+ rem * @see GRID_THEME_BALHAM()
+ rem * @see GRID_THEME_BALHAM_DARK()
+ rem * @see GRID_THEME_MATERIAL()
+ rem */
+ method public void setTheme(BBjString theme$)
+ #getOptions().setTheme(theme$)
+
+ if(#IsReady!) then
+ if info(3,6)>"4" then
+ s$="$doc.getElementById('" + str(#getRootId()) + "').className='ag-theme-"+theme$+"';"
+ else
+ s$="document.getElementById('" + str(#getRootId()) + "').className='ag-theme-"+theme$+"';"
+ FI
+
+ #getExecutor().execute(s$)
+ else
+ template! = #getTemplate()
+ #HTMLView!.setText(template!)
+ FI
+ methodend
+ rem /**
+ rem * Get the grid supported themes
+ rem *
+ rem *
#API
+ rem *
+ rem * @return BBjVector array of theme names
+ rem *
+ rem * @see GRID_THEME_BALHAM()
+ rem * @see GRID_THEME_BALHAM_DARK()
+ rem * @see GRID_THEME_MATERIAL()
+ rem */
+ method public BBjVector getThemes()
+ v! = new BBjVector()
+ v!.addItem(#GRID_THEME_ALPINE())
+ v!.addItem(#GRID_THEME_ALPINE_DARK())
+ v!.addItem(#GRID_THEME_BALHAM())
+ v!.addItem(#GRID_THEME_BALHAM_DARK())
+ v!.addItem(#GRID_THEME_MATERIAL())
+ methodret v!
+ methodend
+ rem /**
+ rem * Enable a chart toolbar item
+ rem *
+ rem *
#Enterprise
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @see CHART_TOOLBAR_SETTINGS()
+ rem * @see CHART_TOOLBAR_DATA()
+ rem * @see CHART_TOOLBAR_FORMAT()
+ rem * @see CHART_TOOLBAR_DOWNLOAD()
+ rem */
+ method public void addChartToolbarItem(BBjString item!)
+ #ChartToolbarItems!.add(item!)
+
+ if(#IsReady! and (#getOptions().getEnableCharts() <> null() and #getOptions().getEnableCharts() = 1)) then
+ #getClientContext().add("chartToolbarItems",#getChartToolbarItems())
+ #updateContext()
+ FI
+ methodend
+ rem /**
+ rem * Disable a chart toolbar item
+ rem *
+ rem *
#Enterprise
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @see CHART_TOOLBAR_SETTINGS()
+ rem * @see CHART_TOOLBAR_DATA()
+ rem * @see CHART_TOOLBAR_FORMAT()
+ rem * @see CHART_TOOLBAR_DOWNLOAD()
+ rem */
+ method public void removeChartToolbarItem(BBjString item!)
+ el! = new JsonPrimitive(item!)
+
+ if #ChartToolbarItems!.contains(el!) then
+ #ChartToolbarItems!.remove(el!)
+ FI
+
+ if(#IsReady! and (#getOptions().getEnableCharts() <> null() and #getOptions().getEnableCharts() = 1)) then
+ #getClientContext().add("chartToolbarItems",#getChartToolbarItems())
+ #updateContext()
+ FI
+ methodend
+ rem /**
+ rem * Set the focus on the given row id and the given column
+ rem *
+ rem *
#API
+ rem * @param BBjString row! The row id
+ rem * @param BBjString column! The column id
+ rem * @param BBjString floating! The row floating (top , bottom or none)
+ rem *
+ rem * @see BBjGridExWidget.GRID_FLOATING_NONE()
+ rem * @see BBjGridExWidget.GRID_FLOATING_TOP()
+ rem * @see BBjGridExWidget.GRID_FLOATING_BOTTOM()
+ rem */
+ method public void focus(BBjString row! , BBjString column! , BBjString floating!)
+ rem DO NOT focus the canvas or the we will have an infinite focus calls
+ rem #super!.focus()
+ REM if info(3,6)<>"6" then
+ if #getCanvas().getParentWindow().getFocusedControlID() <> #getCanvas().getID() then
+ #getHTMLView().clearCallback(BBjAPI.ON_GAINED_FOCUS)
+ #HTMLView!.focus()
+ #getHTMLView().setCallback(BBjAPI.ON_GAINED_FOCUS,#this!,"onGainedFocus")
+ FI
+ REM endif
+ rem /**
+ rem * We never debounce the focus calls , this causes a heck of problems
+ rem * when there are several grids rendered
+ rem */
+ script$="$wnd.gw_setFocusedCell('" + #getRootId() + "','" + str(row!) + "','" + str(column!) + "','" + str(floating!) +"');"
+ #getExecutor().execute(script$)
+ methodend
+ rem /**
+ rem * Set the focus on the given row id and the given column
+ rem *
+ rem *
#API
+ rem * @param BBjString row! The row id
+ rem * @param BBjString column! The column id
+ rem */
+ method public void focus(BBjString row! , BBjString column!)
+ #focus(row!, column!, #GRID_FLOATING_NONE())
+ methodend
+ rem /**
+ rem * Set the focus on the given row id and the first column
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString row! The row id
+ rem */
+ method public void focus(BBjString row!)
+ #focus(row!, "")
+ methodend
+ rem /**
+ rem * Set the focus on the given row id and the given column
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber row! The row id
+ rem * @param BBjString column! The column id
+ rem * @param BBjString floating! The row floating
+ rem *
+ rem * @see BBjGridExWidget.GRID_FLOATING_NONE()
+ rem * @see BBjGridExWidget.GRID_FLOATING_TOP()
+ rem * @see BBjGridExWidget.GRID_FLOATING_BOTTOM()
+ rem */
+ method public void focus(BBjNumber row!, BBjString column!, BBjString floating!)
+ #focus(str(row!), column!, floating!)
+ methodend
+ rem /**
+ rem * Set the focus on the given row id and the given column
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber row! The row id
+ rem * @param BBjString column! The column id
+ rem */
+ method public void focus(BBjNumber row!, BBjString column!)
+ #focus(row!, column!, #GRID_FLOATING_NONE())
+ methodend
+ rem /**
+ rem * Set the focus on the given row id and the first column
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber row! The row id
+ rem */
+ method public void focus(BBjNumber row!)
+ #focus(row!, "")
+ methodend
+ rem /**
+ rem * Will set the focus on the first cell of the first row.
+ rem * In case the grid has already a different selected cell , the the
+ rem * method will retain this information.
+ rem *
+ rem *
#API
+ rem */
+ method public void focus()
+ #focus(-1)
+ methodend
+ rem /**
+ rem * Navigates the grid focus to the next cell, as if tabbing.
+ rem *
+ rem *
#API
+ rem */
+ method public void tabToNextCell()
+ #getExecutor().execute("$wnd.gw_tabToNextCell('" + #getRootId() + "')")
+ methodend
+ rem /**
+ rem * Navigates the grid focus to the previous cell, as if shift-tabbing.
+ rem *
+ rem *
#API
+ rem */
+ method public void tabToPreviousCell()
+ #getExecutor().execute("$wnd.gw_tabToPreviousCell('" + #getRootId() + "')")
+ methodend
+ rem /**
+ rem * select all rows
+ rem *
+ rem *
#API
+ rem */
+ method public void selectAll()
+ scriptKey! = "$wnd.gw_selectAll"
+ script$="$wnd.gw_selectAll('" + #getRootId() + "',0);"
+ #getExecutor().execute(scriptKey!,script$)
+ methodend
+ rem /**
+ rem * select all rows
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBJNumber x!: 0 select all, 1 select all filtered
+ rem */
+ method public void selectAll(BBjNumber x!)
+ #deselectAll()
+ scriptKey! = "$wnd.gw_selectAll"
+ script$="$wnd.gw_selectAll('" + #getRootId() + "'," + str(x!) + ");"
+ #getExecutor().execute(scriptKey!,script$)
+ methodend
+ rem /**
+ rem * deselect all rows
+ rem *
+ rem *
#API
+ rem */
+ method public void deselectAll()
+ scriptKey! = "$wnd.gw_deselectAll"
+ script$="$wnd.gw_deselectAll('" + #getRootId() + "',0);"
+ #getExecutor().execute(scriptKey!,script$)
+ methodend
+ rem /**
+ rem * deselect all rows
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBJNumber x!: 0 deselect all, 1 deselect all filtered
+ rem */
+ method public void deselectAll(BBjNumber x!)
+ scriptKey! = "$wnd.gw_deselectAll"
+ script$="$wnd.gw_deselectAll('"+ #getRootId() + "'," + str(x!) + ");"
+ #getExecutor().execute(scriptKey!,script$)
+ methodend
+ rem /**
+ rem * Select a row by its index
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber x!: the row index to select
+ rem */
+ method public void setSelectedRow(BBjNumber index!)
+ #setSelectedRow(str(index!))
+ methodend
+ rem /**
+ rem * Select a row by its key
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString x!: the row key to select
+ rem */
+ method public void setSelectedRow(BBjString key!)
+ script$="$wnd.gw_setSelectedRows('" + #getRootId() + "',['" + str(key!) + "']);"
+ #getExecutor().execute(script$)
+ methodend
+ rem /**
+ rem * Get the current selected row
+ rem *
+ rem *
#API
+ rem *
+ rem * @return GxClientRowModel The selected row if any, null() otherwise
+ rem */
+ method public GxClientRowModel getSelectedRow()
+ returnedRow! = #getExecutor().execute("$wnd.gw_getSelectedRow('" + #getRootId() + "')",0)
+ if returnedRow!<>null() and len(returnedRow!) > 0 then
+ methodret #getClientJsonFactory().getRow(returnedRow!)
+ FI
+
+ methodret null()
+ methodend
+ rem /**
+ rem * Select a vector of rows.
+ rem * The vector can contain a mix of row indices and row keys
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBJNumber x!: vector of row indices and row keys to select
+ rem */
+ method public void setSelectedRows(BBjVector x!)
+ script$="$wnd.gw_setSelectedRows('" + #getRootId() + "',["
+ it! = x!.iterator()
+ first=1
+ while it!.hasNext()
+ if first
+ first=0
+ else
+ script$=script$+","
+ FI
+
+ script$ = script$ + "'" + str(it!.next()) + "'"
+ wend
+
+ script$=script$+"]);"
+ #getExecutor().execute(script$)
+ methodend
+ rem /**
+ rem * Get Array of selected rows
+ rem *
+ rem *
#API
+ rem *
+ rem * @return BBjVector A vector filled with the selected rows
+ rem */
+ method public BBjVector getSelectedRows()
+ rows! = new BBjVector()
+
+ if (#getRS() = null()) then
+ goto getSelectedRowsErr
+ FI
+
+ returnedRows! = #getExecutor().execute("$wnd.gw_getSelectedRows('" + #getRootId() + "')" , 0)
+ if returnedRows! = null() then
+ goto getSelectedRowsErr
+ FI
+
+ parser! = new JsonParser()
+ array! = parser!.parse(returnedRows!).getAsJsonArray()
+ it! = array!.iterator()
+ while (it!.hasNext())
+ next! = it!.next().getAsJsonObject(err=getSelectedRowsErr)
+ rows!.add(#getClientJsonFactory().getRow(next!))
+ wend
+
+ getSelectedRowsErr:
+ methodret rows!
+ methodend
+ rem /**
+ rem * Returns the row with the given key from the grid.
+ rem *
+ rem * Note : if you only need to get the row and
+ rem * you don't care about other meta data like parent(when grouping) , isSelected,... then use the
+ rem * ResultSet API (ex ResultSet.getItem(BBjString key!) )
+ rem *
+ rem * @param BBjString key! the row's key
+ rem *
+ rem * @return GxClientRowModel the grid's row model
+ rem *
+ rem * @see ResultSet.getItem
+ rem */
+ method public GxClientRowModel getRow(BBjString key!)
+ returnedRow! = #getExecutor().execute("$wnd.gw_getRow('" + #getRootId() + "','" + key! + "')" , 0)
+ if returnedRow! <> null() and len(returnedRow!) > 0 then
+ methodret #getClientJsonFactory().getRow(returnedRow!)
+ FI
+
+ methodret null()
+ methodend
+ rem /**
+ rem * Get the rows from grid in the given phase after applying the given
+ rem * filter expression.
+ rem *
+ rem * Note: if you only need to get the whole rows from the grid and you don't care about
+ rem * filtering and sorting Then retrieve them from ResultSet as this will be faster
+ rem * especially in BUI
+ rem *
+ rem * @param BBjString phase! The rows phase
+ rem * @param BBjString filterExpression! A filter expression to execute before returning the rows.
+ rem * The expression must return true or false for the given row
+ rem *
+ rem * @return BBjVector A vector of GxClientRowModel(s)
+ rem *
+ rem * @see #GRID_ROWS_PHASE_ALL()
+ rem * @see #GRID_ROWS_PHASE_AFTER_FILTER()
+ rem * @see #GRID_ROWS_PHASE_AFTER_FILTER_SORT()
+ rem *
+ rem * @see see GxExpression
+ rem */
+ method public BBjVector getRows(BBjString phase! , BBjString filterExpression!)
+ rows! = new BBjVector()
+ returnedRows! = #getExecutor().execute("$wnd.gw_getRows('" + #getRootId() + "','" + phase! + "'," + (new Gson()).toJson(filterExpression!) + ")" , 0)
+ if returnedRows! <> null() AND returnedRows! <> "[]" then
+ parser! = new JsonParser()
+ array! = parser!.parse(returnedRows!).getAsJsonArray()
+ it! = array!.iterator()
+ while (it!.hasNext())
+ next! = it!.next().getAsJsonObject()
+ rows!.add(#getClientJsonFactory().getRow(next!))
+ wend
+ FI
+
+ methodret rows!
+ methodend
+ rem /**
+ rem * Get the rows from grid in the given phase after applying the given
+ rem * filter expression.
+ rem *
+ rem * Note: if you only need to get the whole rows from the grid and you don't care about
+ rem * filtering and sorting Then retrieve them from ResultSet as this will be faster
+ rem * especially in BUI
+ rem *
+ rem * @param BBjString phase! The rows phase
+ rem * @param GxExpressionInterface filterExpression! A filter expression to execute before returning the rows.
+ rem * The expression must return true or false for the given row
+ rem *
+ rem * @return BBjVector A vector of GxClientRowModel(s)
+ rem *
+ rem * @see #GRID_ROWS_PHASE_ALL()
+ rem * @see #GRID_ROWS_PHASE_AFTER_FILTER()
+ rem * @see #GRID_ROWS_PHASE_AFTER_FILTER_SORT()
+ rem *
+ rem * @see see GxExpression
+ rem */
+ method public BBjVector getRows(BBjString phase! , GxExpressionInterface filterExpression!)
+ methodret #getRows(phase!, filterExpression!.toString())
+ methodend
+ rem /**
+ rem * Get the rows from grid in the given phase after applying the given
+ rem * filter expression.
+ rem *
+ rem * Note: if you only need to get the whole rows from the grid and you don't care about
+ rem * filtering and sorting Then retrieve them from ResultSet as this will be faster
+ rem * especially in BUI
+ rem *
+ rem * @param BBjString phase! The rows phase
+ rem *
+ rem * @return BBjVector A vector of GxClientRowModel(s)
+ rem *
+ rem * @see #GRID_ROWS_PHASE_ALL()
+ rem * @see #GRID_ROWS_PHASE_AFTER_FILTER()
+ rem * @see #GRID_ROWS_PHASE_AFTER_FILTER_SORT()
+ rem */
+ method public BBjVector getRows(BBjString phase!)
+ methodret #getRows(phase!, "")
+ methodend
+ rem /**
+ rem * Get the rows from grid after sorting and filtering
+ rem *
+ rem * @return BBjVector A vector of GxClientRowModel(s)
+ rem */
+ method public BBjVector getRows()
+ methodret #getRows(#GRID_ROWS_PHASE_AFTER_FILTER_SORT())
+ methodend
+ rem /**
+ rem * Expand all groups
+ rem *
+ rem *
#API
+ rem */
+ method public void expandAll()
+ script$="$wnd.gw_expandAll('" + #getRootId() +"');"
+ #getExecutor().execute(script$)
+ methodend
+ rem /**
+ rem * collapse all groups
+ rem *
+ rem *
#API
+ rem */
+ method public void collapseAll()
+ script$="$wnd.gw_collapseAll('" + #getRootId() +"');"
+ #getExecutor().execute(script$)
+ methodend
+ rem /**
+ rem * Ensures the row key is visible by vertically scrolling the grid
+ rem *
+ rem * Ensures the row index is visible by vertically scrolling the grid.
+ rem * The valid values for positions are {'top', 'middle', 'bottom'}.
+ rem * If top, middle or bottom, the grid will scroll the row to place the row at top, middle or bottom
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString key!: the row key
+ rem * @param BBjString position!: the scrolling position
+ rem *
+ rem * @see GRID_ROWPOS_TOP()
+ rem * @see GRID_ROWPOS_MIDDLE()
+ rem * @see GRID_ROWPOS_BOTTOM()
+ rem */
+ method public void ensureIndexVisible(BBjString key! , BBjString position!)
+ scriptKey! = "$wnd.gw_ensureIndexVisible"
+ script$="$wnd.gw_ensureIndexVisible('" + #getRootId() + "','" + str(key!) + "','" + str(position!) +"');"
+ #getExecutor().execute(scriptKey!,script$)
+ methodend
+ rem /**
+ rem * Ensures the row index is visible by vertically scrolling the grid
+ rem *
+ rem * Ensures the row index is visible by vertically scrolling the grid.
+ rem * The valid values for positions are {'top', 'middle', 'bottom'}.
+ rem * If top, middle or bottom, the grid will scroll the row to place the row at top, middle or bottom
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber index!: the row index
+ rem * @param BBjString position!: the scrolling position
+ rem *
+ rem * @see GRID_ROWPOS_TOP()
+ rem * @see GRID_ROWPOS_MIDDLE()
+ rem * @see GRID_ROWPOS_BOTTOM()
+ rem */
+ method public void ensureIndexVisible(BBjNumber index! , BBjString position!)
+ #ensureIndexVisible(str(index!),position!)
+ methodend
+ rem /**
+ rem * Ensures the row index is visible by vertically scrolling the grid
+ rem *
+ rem * Ensures the row index is visible by vertically scrolling the grid.
+ rem * The valid values for positions are {'top', 'middle', 'bottom'}.
+ rem * If top, middle or bottom, the grid will scroll the row to place the row at top, middle or bottom
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber index!: the row index
+ rem * @param BBjString position!: the scrolling position
+ rem *
+ rem * @see GRID_ROWPOS_TOP()
+ rem * @see GRID_ROWPOS_MIDDLE()
+ rem * @see GRID_ROWPOS_BOTTOM()
+ rem *
+ rem * @deprecated since version 0.101.0, BBjGridExWidget.setVisibleRow(BBjNumber index! , BBjString position!) is deprecated / renamed. Use BBjGridExWidget.ensureIndexVisible(BBjNumber index! , BBjString position!) instead.
+ rem */
+ method public void setVisibleRow(BBjNumber index! , BBjString position!)
+ GxLogger.warn("since version 0.101.0, BBjGridExWidget.setVisibleRow(BBjNumber index! , BBjString position!) is deprecated / renamed. Use BBjGridExWidget.ensureIndexVisible(BBjNumber index! , BBjString position!) instead.")
+ #ensureIndexVisible(index!,position!)
+ methodend
+ rem /**
+ rem * Ensures the column is visible, scrolling the table if needed.
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBJString columnid!: the column id
+ rem */
+ method public void ensureColumnVisible(BBjString columnId!)
+ scriptKey! = "$wnd.gw_ensureColumnVisible"
+ script$="$wnd.gw_ensureColumnVisible('" + #getRootId() + "','" + columnId! + "');"
+ #getExecutor().execute(scriptKey!,script$)
+ methodend
+ rem /**
+ rem * Sets the visibility of column(s)
+ rem *
+ rem * @param BBjString columns! A comma separated list of column ids to hide / show
+ rem * @param BBjNumber hidden! True to hide , false to show
+ rem */
+ method public void setColumnVisible(BBjString columns! , BBjNumber hidden!)
+ ids! = Arrays.asList(columns!.replaceAll(" ","").split(","))
+ it! = ids!.iterator()
+ while it!.hasNext()
+ next! = it!.next()
+
+ if(#hasColumn(next!))
+ #getColumn(next!).setHidden(hidden!)
+ fi
+ wend
+
+ script$="$wnd.gw_setColumnVisible('" + #getRootId() + "','" + columns! + "'," + str(hidden!.booleanValue()) +");"
+ #getExecutor().execute(script$)
+ methodend
+ rem /**
+ rem * Sets the visibility of a column
+ rem *
+ rem * @param GxColumn column! The column definition
+ rem * @param BBjNumber hidden! True to hide , false to show
+ rem */
+ method public void setColumnVisible(GxColumn column! , BBjNumber hidden!)
+ #setColumnVisible(column!.getField(), hidden!)
+ methodend
+ rem /**
+ rem * Ensures the column is visible, scrolling the table if needed.
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBJString columnid!: the column id
+ rem *
+ rem * @deprecated since version 0.101.0, BBjGridExWidget.setVisibleColumn(BBjString columnId!) is deprecated / renamed. Use BBjGridExWidget.ensureColumnVisible(BBjString columnId!) instead.
+ rem */
+ method public void setVisibleColumn(BBjString columnId!)
+ GxLogger.warn("since version 0.101.0, BBjGridExWidget.setVisibleColumn(BBjString columnId!) is deprecated / renamed. Use BBjGridExWidget.ensureColumnVisible(BBjString columnId!) instead.")
+ #ensureColumnVisible(columnId!)
+ methodend
+ rem /**
+ rem * Make the currently visible columns fit the screen.
+ rem *
+ rem * The columns will scale (growing or shrinking) to fit the available width.
+ rem * If you don't want a particular column to be included in the auto resize,
+ rem * then set the column setting SuppressSizeToFit=true.
+ rem * This is helpful if, for example, you want the first column to remain fixed with, but all other columns
+ rem * to fill the width of the table.
+ rem *
+ rem *
#API
+ rem */
+ method public void setFitToGrid()
+ scriptKey! = "$wnd.gw_sizeColumnsToFit"
+ #getExecutor().execute(scriptKey!,"$wnd.gw_sizeColumnsToFit('" + #getRootId() +"')")
+ methodend
+ rem /**
+ rem * Gets the grid to size the columns to the specified with
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber width! the width to use to fit all columns in
+ rem */
+ method public void setFitToGrid(BBjNumber width!)
+ scriptKey! = "$wnd.gw_sizeColumnsToFit"
+ #getExecutor().execute(scriptKey!,"$wnd.gw_sizeColumnsToFit('" + #getRootId() +"','" + str(width!) + "')")
+ methodend
+ rem /**
+ rem * looks at the rendered cells on the screen, and works out the width based on what it sees.
+ rem * It cannot see the columns that are not rendered due to column virtualisation.
+ rem * Thus it is not possible to autosize a column that is not visible on the screen.
+ rem *
+ rem * Column Virtualisation is the technique the grid uses to render large amounts of columns with
+ rem * degrading performance by only rendering columns that are visible due to the horizontal scroll positions.
+ rem * Eg the grid can have 1000 columns with only 10 rendered if the horizontal scroll is only showing 10 columns.
+ rem * To get around this, you can turn off column virtualisation by setting grid options SuppressColumnVirtualisation=true.
+ rem *
+ rem *
#API
+ rem *
+ rem * @param HashSet columns! A set of columns to auto size
+ rem * @param BBjNumber skipHeader! indicate that the header content (headerName) should not be considered when calculating
+ rem * the width of the column.
+ rem * You can also set this behavior to be the default by setting SkipHeaderOnAutoSize: true
+ rem * in the grid options.
+ rem */
+ method public void autoSizeColumns(HashSet columns!, BBjNumber skipHeader!)
+ columnsAsJson! = new Gson().toJson(columns!)
+ #getExecutor().execute("$wnd.gw_autoSizeColumns('" + #getRootId() +"'," + str(skipHeader!.booleanValue()) + "," + str(columnsAsJson!) + ")")
+ methodend
+ rem /**
+ rem * looks at the rendered cells on the screen, and works out the width based on what it sees.
+ rem * It cannot see the columns that are not rendered due to column virtualisation.
+ rem * Thus it is not possible to autosize a column that is not visible on the screen.
+ rem *
+ rem * Column Virtualisation is the technique the grid uses to render large amounts of columns with
+ rem * degrading performance by only rendering columns that are visible due to the horizontal scroll positions.
+ rem * Eg the grid can have 1000 columns with only 10 rendered if the horizontal scroll is only showing 10 columns.
+ rem * To get around this, you can turn off column virtualisation by setting grid options SuppressColumnVirtualisation=true.
+ rem *
+ rem *
#API
+ rem *
+ rem * @param HashSet columns! A set of columns to auto size
+ rem */
+ method public void autoSizeColumns(HashSet columns!)
+ #autoSizeColumns(columns! , 0)
+ methodend
+ rem /**
+ rem * looks at the rendered cells on the screen, and works out the width based on what it sees.
+ rem * It cannot see the columns that are not rendered due to column virtualisation.
+ rem * Thus it is not possible to autosize a column that is not visible on the screen.
+ rem *
+ rem * Column Virtualisation is the technique the grid uses to render large amounts of columns with
+ rem * degrading performance by only rendering columns that are visible due to the horizontal scroll positions.
+ rem * Eg the grid can have 1000 columns with only 10 rendered if the horizontal scroll is only showing 10 columns.
+ rem * To get around this, you can turn off column virtualisation by setting grid options SuppressColumnVirtualisation=true.
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! A common separated list of columns to auto size
+ rem * @param BBjNumber skipHeader! indicate that the header content (headerName) should not be considered when calculating
+ rem * the width of the column.
+ rem * You can also set this behavior to be the default by setting SkipHeaderOnAutoSize: true
+ rem * in the grid options.
+ rem */
+ method public void autoSizeColumns(BBjString columns!, BBjNumber skipHeader!)
+ columnsSet! = new HashSet()
+ columnsSet!.addAll(Arrays.asList(columns!.replaceAll(" ","").split(",")))
+ #autoSizeColumns(columnsSet!,skipHeader!)
+ methodend
+ rem /**
+ rem * looks at the rendered cells on the screen, and works out the width based on what it sees.
+ rem * It cannot see the columns that are not rendered due to column virtualisation.
+ rem * Thus it is not possible to autosize a column that is not visible on the screen.
+ rem *
+ rem * Column Virtualisation is the technique the grid uses to render large amounts of columns with
+ rem * degrading performance by only rendering columns that are visible due to the horizontal scroll positions.
+ rem * Eg the grid can have 1000 columns with only 10 rendered if the horizontal scroll is only showing 10 columns.
+ rem * To get around this, you can turn off column virtualisation by setting grid options SuppressColumnVirtualisation=true.
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! A comma separated list of columns to auto size
+ rem */
+ method public void autoSizeColumns(BBjString columns!)
+ #autoSizeColumns(columns! , 0)
+ methodend
+ rem /**
+ rem * looks at the rendered cells on the screen, and works out the width based on what it sees.
+ rem * It cannot see the columns that are not rendered due to column virtualisation.
+ rem * Thus it is not possible to autosize a column that is not visible on the screen.
+ rem *
+ rem * Column Virtualisation is the technique the grid uses to render large amounts of columns with
+ rem * degrading performance by only rendering columns that are visible due to the horizontal scroll positions.
+ rem * Eg the grid can have 1000 columns with only 10 rendered if the horizontal scroll is only showing 10 columns.
+ rem * To get around this, you can turn off column virtualisation by setting grid options SuppressColumnVirtualisation=true.
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber skipHeader! indicate that the header content (headerName) should not be considered when calculating
+ rem * the width of the column.
+ rem * You can also set this behavior to be the default by setting SkipHeaderOnAutoSize: true
+ rem * in the grid options.
+ rem */
+ method public void autoSizeColumns(BBjNumber skipHeader!)
+ #autoSizeColumns(new HashSet(),skipHeader!)
+ methodend
+ rem /**
+ rem * looks at the rendered cells on the screen, and works out the width based on what it sees.
+ rem * It cannot see the columns that are not rendered due to column virtualisation.
+ rem * Thus it is not possible to autosize a column that is not visible on the screen.
+ rem *
+ rem * Column Virtualisation is the technique the grid uses to render large amounts of columns with
+ rem * degrading performance by only rendering columns that are visible due to the horizontal scroll positions.
+ rem * Eg the grid can have 1000 columns with only 10 rendered if the horizontal scroll is only showing 10 columns.
+ rem * To get around this, you can turn off column virtualisation by setting grid options SuppressColumnVirtualisation=true.
+ rem *
+ rem *
#API
+ rem */
+ method public void autoSizeColumns()
+ #autoSizeColumns(0)
+ methodend
+ rem /**
+ rem *Gets the grid to remove a row from the DOM and recreate it again from scratch.
+ rem */
+ method public void redrawRows()
+ #getExecutor().execute("$wnd.gw_redrawRows('" + #getRootId() +"')")
+ methodend
+ rem /**
+ rem * Force the context object update
+ rem */
+ method public void updateContext()
+ if(#IsReady!)
+ #getExecutor().execute("$wnd.gw_updateContext('" + #getRootId() +"'," + #getClientContext().toString() + ")")
+ FI
+ methodend
+ rem /**
+ rem * Set and apply filter model for the given column
+ rem *
+ rem * @param BBjString column! the column id
+ rem * @param GxClientFilterModel model! the model filter to use
+ rem *
+ rem *
#API
+ rem *
#Configuration
+ rem *
+ rem * @return GxClientFilterModel the passed model
+ rem */
+ method public GxClientFilterModel setFilterModel(BBjString column!, GxClientFilterModel model!)
+ model!.setWidget(#this!)
+ model!.setColumn(column!)
+ model!.update()
+ methodret model!
+ methodend
+ rem /**
+ rem * Set and apply a filter transaction
+ rem *
+ rem * The transaction is a `LinkedHashMap` of columns and their models.
+ rem * This the fastest way to apply several filters on several columns.
+ rem * When using this method The grid will delay executing the filters on the data
+ rem * until all models are set and ready.
+ rem *
+ rem *
#API
+ rem *
#Configuration
+ rem *
+ rem * @param LinkedHashMap transaction! a map of columns and their model
+ rem */
+ method public void executeFilterTransaction(LinkedHashMap transaction!)
+ applyCode! = new HashSet()
+ executeCode! = new HashSet()
+ it! = transaction!.entrySet().iterator()
+ while(it!.hasNext())
+ next! = it!.next()
+ column! = next!.getKey()
+ model! = next!.getValue()
+ model!.setWidget(#this!)
+ model!.setColumn(column!)
+ applyCode!.add(model!.apply(0))
+ executeCode!.add(model!.execute(0))
+ wend
+
+ #getExecutor().execute(String.join("",applyCode!) + String.join("",executeCode!))
+ methodend
+ rem /**
+ rem * Get The filter model for the given column
+ rem *
+ rem * This method will return a `GxClientFilterModel` for the given column
+ rem * If column has already some filter values set through the UI , then the model will contain
+ rem * these changes too.
+ rem *
+ rem * In case the grid is not ready (not renderer yet) then the method will just return
+ rem * any empty filter model for the column.
+ rem *
+ rem *
#API
+ rem *
#Configuration
+ rem *
+ rem * @param BBjString column! the column id to use for the constructed model
+ rem *
+ rem * @throws 256 in case the column has no filter component attached
+ rem */
+ method public GxClientFilterModel getFilterModel(BBjString column!)
+ jsonModel! = null()
+ rem we try to get the model from the UI first
+ if(#getIsReady() = BBjAPI.TRUE)
+ code! = String.format("JSON.stringify($wnd.gw_getGrid('%s').options.api.getFilterInstance('%s').getModel());" , #getRootId(), column!)
+ jsonModel! = #getExecutor().execute(code! , 0)
FI
- FI
-
- htmlview!.setCallback(BBjAPI.ON_PAGE_LOADED,#this!,"onInit")
- htmlview!.setCallback(BBjAPI.ON_NATIVE_JAVASCRIPT,#this!,"onNativeEvent")
- htmlview!.setCallback(BBjAPI.ON_GAINED_FOCUS,#this!,"onGainedFocus")
- htmlview!.setText(html$)
- #HTMLView!=htmlview!
- else
- #HTMLView!.setSize(#getCanvas().getWidth(),#getCanvas().getHeight())
- FI
- methodend
- rem /**
- rem * Inject a js Script at the top window.
- rem *
- rem * If for some reason you want to inject a script in the iframe , then use the injectScript method
- rem * from the created internal HTML View.
- rem *
- rem * @see BBjHtmlView::injectScript
- rem *
- rem * @param BBjString script! the path for the javascript file
- rem */
- method public void injectScript(BBjString script!)
- #HTMLView!.injectScript(new String(script!.getBytes(),"UTF-8") , 1)
- methodend
- rem /**
- rem * Execute a javascript code on the client.
- rem *
- rem * Note that if the grid is not ready yet , then script will queued until the grid is ready then send
- rem * to the client.
- rem * If some reason you do not want this behavior , then use the executeScript method from the created internal
- rem * HTML View
- rem *
- rem * @see BBjHtmlView::executeScript
- rem *
- rem * @param BBjString script$ The javascript code
- rem *
- rem * @return Object returned value, if any
- rem */
- method public Object executeScript(BBjString script$)
- methodret #getExecutor().execute(script$)
- methodend
- rem /**
- rem * When true then the executor will limit the rate at
- rem * which executeScript gets invoked on the HTMLView.
- rem *
- rem * Setting this to "0" will help to boost up the communication
- rem * performance between BBj and the grid which lives inside
- rem * the HTMLView in BUI context
- rem *
- rem * By default this options is set to "0"
- rem *
- rem * @param BBjNumber suppress! true to suppress , false to enable
- rem */
- method public void suppressBuiDebouncing(BBjNumber suppress!)
- #getExecutor().setSuppressBuiDebouncing(suppress!)
- methodend
- rem /**
- rem * When true then the executor will limit the rate at
- rem * which executeScript gets invoked on the HTMLView.
- rem *
- rem * Setting this to "0" will help to boost up the communication
- rem * performance between BBj and the grid which lives inside
- rem * the HTMLView in GUI context
- rem *
- rem * By default this options is set to "1"
- rem *
- rem * @param BBjNumber suppress! true to suppress , false to enable
- rem */
- method public void suppressGuiDebouncing(BBjNumber suppress!)
- #getExecutor().setSuppressGuiDebouncing(suppress!)
- methodend
- rem /**
- rem * Suppress scripts debouncing for GUI and BUI
- rem *
- rem * @see #suppressBuiDebouncing()
- rem * @see #suppressGuiDebouncing()
- rem *
- rem * @param BBjNumber suppress! true to suppress , false to enable
- rem */
- method public void suppressDebouncing(BBjNumber suppress!)
- #suppressBuiDebouncing(suppress!)
- #suppressGuiDebouncing(suppress!)
- methodend
- rem /**
- rem * An Event listener executed after the initial load of the HTML View.
- rem *
- rem * At this phase the grid will inject all required js files in the client to make the grid functional.
- rem *
- rem * @param BBjEvent ev! The onLoad event
- rem */
- method public void onInit(BBjEvent ev!)
- #HTMLView!.clearCallback(BBjAPI.ON_PAGE_LOADED)
- isLicensed! = 0
-
- if (#getForceCommunityBuild() = 0) then
- isLicensed! = #isLicensed()
- FI
- rem /**
- rem * work out the required js files
- rem */
- basePath$ = "BBjGridExWidget/client/dist"
- agGridPath$ = iff(isLicensed!, (basePath$ + "/ag-grid-enterprise.min.js") , (basePath$ +"/ag-grid-community.min.js"))
- gxPath$ = basePath$ + "/bbj-grid-widget.min.js"
- rem for debugging we inject the unminified files which contain source maps of the original code
- if #getDebug() = 1 then
- agGridPath$ = iff(isLicensed!, (basePath$ + "/ag-grid-enterprise.js") , (basePath$ +"/ag-grid-community.js"))
- gxPath$ = basePath$ + "/bbj-grid-widget.js"
- FI
- rem /**
- rem * Bundle the content of all required scripts
- rem */
- scriptsSet! = new HashSet()
- scriptsSet!.add(agGridPath$)
- scriptsSet!.add(gxPath$)
- rem /**
- rem * This is the most important piece , without it the grid won't work in GUI
- rem *
- rem * Why?
- rem *
- rem * in BUI we use GWT and GWT uses $wnd instead of window because compiled code is executed normally in an iframe,
- rem * and in this context, window will reference the iframe window while $wnd will reference the parent window.
- rem * The same occurs with $doc which is a reference in the iframe to the parent document.
- rem *
- rem * All JS calls we run from the grid are executed in the $wnd context because all scripts
- rem * are inject in the top level window
- rem *
- rem * In GUI there is no iframe which means theres is no $wnd or $doc , because of this all
- rem * the JS code we execute from the grid will throw an error , we polyfill these two vars
- rem * for GUI to get around the problem
- rem */
- rem bundle$ = "var $wnd = (typeof $wnd !== 'undefined' ? $wnd : window);"
- rem bundle$ = bundle$ + "var $doc = (typeof $doc !== 'undefined' ? $doc : document);"
- bundle$ = "var $wnd = window;"
- bundle$ = bundle$ + "var $doc = document;"
- rem loop over the require scripts and attach to the bundle
- it! = scriptsSet!.iterator()
- while(it!.hasNext())
- path! = it!.next()
- ch=unt
- open (ch)path!
- read record (ch,siz=5512000)content$
- close (ch)
- bundle$ = bundle$ + content$
- wend
- rem finally inject the built bundle
- #injectScript(bundle$)
- rem /**
- rem * Some customers reported that the second ON_PAGE_LOADED event is not fired
- rem * so we call the onLoaded method manually in case the event is not fired
- rem *
- rem * could even directly call the onLoaded Method from here
- rem * #onLoaded(null())
- rem */
- BBjAPI().createTimer(str(#this!)+"onLoadFallback",.2,#this!,"onLoaded")
- methodend
- rem /**
- rem * An Event listener executed after the second ON_PAGE_LOADED event
- rem *
- rem * At this phase the grid flush all enqueued scripts
- rem *
- rem * @param BBjEvent ev! The onLoad event
- rem */
- method public void onLoaded(BBjEvent ev!)
- #HTMLView!.clearCallback(BBjAPI.ON_PAGE_LOADED)
- BBjAPI().removeTimer(str(#this!)+"onLoadFallback",err=*next)
- #getLicenseManager().register(#this!)
- #IsReady! = BBjAPI.TRUE
- #render()
- #getExecutor().flush()
-
- if (#newW! <> null() and #newH!<> null()) then
- #super!.setSize(#newW!,#newH!)
- #newW! = null()
- #newH! = null()
- FI
- methodend
- rem /**
- rem * Focus the grid by selecting the cell in the first cell and first column.
- rem *
- rem * Note: If the grid has already a different selected cell , then
- rem * the event handler will retain the selection
- rem *
- rem * @param BBjGainedFocusEvent ev! The focus event
- rem */
- method public void onGainedFocus(BBjGainedFocusEvent ev!)
- if(ev!.isTemporary())
- methodret
- FI
-
- #focus()
- methodend
- rem /**
- rem * On NativeEvent
- rem *
- rem * Event Handler for Native JavaScript Event coming from the client
- rem * Determines and dispatches the actual event
- rem *
- rem * @param BBjNativeJavaScriptEvent ev! The Javascript Event
- rem */
- method public void onNativeEvent(BBjNativeJavaScriptEvent ev!)
- map! = ev!.getEventMap()
- type$ = str(map!.get("type"))
- detail$ = str(map!.get("detail"))
- switch type$
- case "gw.rowSelect"
- #onSelectRowChange(detail$, #ON_GRID_SELECT_ROW())
- break
- case "gw.rowClick"
- #onSelectRowChange(detail$,#ON_GRID_ROW_CLICK())
- break
- case "gw.rowDoubleClick"
- #onSelectRowChange(detail$,#ON_GRID_DOUBLE_CLICK())
- break
- case "gw.cellClicked"
- #onCellEvent(detail$,#ON_GRID_CELL_CLICK())
- break
- case "gw.cellDoubleClicked"
- #onCellEvent(detail$,#ON_GRID_CELL_DOUBLE_CLICK())
- break
- case "gw.rangeSelection"
- #onRangeSelectionChange(detail$)
- break
- case "gw.cellEditingStarted"
- #onCellEvent(detail$,#ON_GRID_CELL_EDITING_STARTED())
- break
- case "gw.cellEditingStopped"
- #onCellEvent(detail$,#ON_GRID_CELL_EDITING_STOPPED())
- break
- case "gw.cellValueChanged"
- #onCellEvent(detail$,#ON_GRID_CELL_VALUE_CHANGED())
- break
- case "gw.rowEditingStarted"
- #onRowEditing(detail$,#ON_GRID_ROW_EDITING_STARTED())
- break
- case "gw.rowEditingStopped"
- #onRowEditing(detail$,#ON_GRID_ROW_EDITING_STOPPED())
- break
- case "gw.rowValueChanged"
- #onRowEditing(detail$,#ON_GRID_ROW_VALUE_CHANGED())
- break
- case "gw.stateChanged"
- #handleStateChangedEvent(detail$,#ON_GRID_STATE_CHANGE())
- break
- case "gw.contextmenu"
- #onContextmenuEvent(detail$)
- break
- case "gw.keypress"
- #onKeypressEvent(detail$)
- break
- case "gw.suggestion"
- #onSuggestionEvent(detail$)
- break
- case "gw.filterChanged"
- #onFilterChangedEvent()
- break
- case "gw.gridReady"
- #onGridReadyEvent()
- break
- swend
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public GxColumn addColumn(GxColumn definition!)
- methodret #getColumnsManager().addColumn(definition!)
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public GxColumn addColumn(BBjString field!,BBjNumber type!)
- methodret #getColumnsManager().addColumn(field! , type!)
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public GxColumn addColumn(BBjString field!,BBjString label!)
- methodret #getColumnsManager().addColumn(field! , label!)
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public GxColumn addColumn(BBjString field!, BBjString label! , BBjNumber type!)
- methodret #getColumnsManager().addColumn(field! , label! ,type!)
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public GxColumn addColumn(BBjString field!)
- methodret #addColumn(field!,field!)
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public GxColumn getColumn(BBjString field!)
- methodret #getColumnsManager().getColumn(field!)
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public BBjNumber hasColumn(BBjString field!)
- methodret #getColumnsManager().hasColumn(field!)
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public GxColumn removeColumn(BBjString field!)
- methodret #getColumnsManager().removeColumn(field!)
- methodend
- rem /**
- rem * Sets the foreground color for a column
- rem *
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem * @param BBjString field$ The field name of the column definition
- rem * @param BBjColor color! the color for the column
- rem */
- method public void setColumnForeColor(BBjString field$,BBjColor color!)
- #getColumn(field$).setForeColor(color!)
- methodend
- rem /**
- rem * Sets the foreground color for a column
- rem *
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem * @param BBjString field$ The field name of the column definition
- rem * @param BBjString color$ Valid CSS color
- rem *
- rem * @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
- rem */
- method public void setColumnForeColor(BBjString field$,BBjString color!)
- #getColumn(field$).setForeColor(color!)
- methodend
- rem /**
- rem * Sets the background color of a column
- rem *
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem * @param BBjString field$ The field name of the column definition
- rem * @param BBjColor color! The color for the column
- rem */
- method public void setColumnBackColor(BBjString field$,BBjColor color!)
- #getColumn(field$).setBackColor(color!)
- methodend
- rem /**
- rem * Sets the background color of a column
- rem *
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem * @param BBjString field$ The field name of the column definition
- rem * @param BBjColor color$ Valid CSS color
- rem *
- rem * @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
- rem */
- method public void setColumnBackColor(BBjString field$,BBjString color!)
- #getColumn(field$).setBackColor(color!)
- methodend
- rem /**
- rem * Sets the default alignment for a column
- rem *
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem * @param BBjString field! The field name of the column definition
- rem * @param BBjNumber align! The column alignment
- rem *
- rem * valid alignments:
- rem *
- rem * @see GRID_ALIGN_LEFT()
- rem * @see GRID_ALIGN_CENTER()
- rem * @see GRID_ALIGN_RIGHT()
- rem *
- rem * @RequiresRefresh
- rem */
- method public void setColumnAlignment(BBjString field!, BBjNumber align!)
- #getColumn(field!).setAlignment(align!)
- methodend
- rem /**
- rem * Sets the default alignment for a column's header
- rem *
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem * @param BBjString field! The field name of the column definition
- rem * @param BBjNumber align! The column's header alignment
- rem *
- rem * valid alignments:
- rem *
- rem * @see GRID_ALIGN_LEFT()
- rem * @see GRID_ALIGN_CENTER()
- rem * @see GRID_ALIGN_RIGHT()
- rem *
- rem * @RequiresRefresh
- rem */
- method public void setColumnHeaderAlignment(BBjString field!, BBjNumber align!)
- #getColumn(field!).setHeaderAlignment(align!)
- methodend
- rem /**
- rem * Sets the width of a column
- rem *
- rem *
#Configuration
- rem *
#API
- rem *
- rem *
- rem * Note: Unlike setting the width in the column definition, this method will update a column width without
- rem * a full re-render.
- rem *
- rem * @param BBjString field$ The field name of the column definition
- rem * @param BBjNumber width! The column width
- rem */
- method public void setColumnWidth(BBjString field$, BBjNumber width!)
- if #hasColumn(field$) then
- #getColumn(field$).setWidth(width!)
- scriptKey! = "$wnd.gw_setColumnWidth_" + field$
- #getExecutor().execute(scriptKey! , "$wnd.gw_setColumnWidth('"+ #getRootId() + "','" + field$ + "'," + str(width!) + ");")
- FI
- methodend
- rem /**
- rem * Pin a column of the grid to the left or the right margin
- rem *
- rem *
#API
- rem *
- rem * @param BBjString field$ The field name of the column
- rem * @param BBjString pin$ The pin direction ("right" or "left")
- rem *
- rem * @see GxColumn.PINNED_LEFT()
- rem * @see GxColumn.PINNED_RIGHT()
- rem */
- method public void pinColumn(BBjString field$, BBjString pin$)
- pin$=cvs(pin$,8)
-
- if #hasColumn(field$) then
- #getColumn(field$).setPinned(pin$)
- scriptKey! = "$wnd.gw_pinColumn" + field$
- #getExecutor().execute(scriptKey!,"$wnd.gw_pinColumn('" + #getRootId() + "','" + field$ + "','" + pin$ + "');")
- FI
- methodend
- rem /**
- rem * Change column position
- rem *
- rem *
#API
- rem *
- rem * @param BBjString field$ The field name of the column
- rem * @param BBjNumber toIndex! The new column position/index
- rem */
- method public void moveColumn(BBjString Field$, BBjNumber toIndex!)
- scriptKey! = "$wnd.gw_moveColumn" + field$
- script$="$wnd.gw_moveColumn('" + #getRootId() + "','" + field$ + "'," + str(toIndex!) + ");"
- #getExecutor().execute(scriptKey!,script$)
- methodend
- rem /**
- rem * Set the mask of a column using value formatter expression.
- rem *
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem *
- rem * Note: This method will override the ValueFormatterExpression of the column.The method depends on
- rem * the column type to determine the correct value formatter (number, date, ...)
- rem *
- rem ng field! The column's field
- rem * @param BBjString mask!: The (date or numeric) mask, BBj style
- rem */
- method public void setColumnMask(BBjString field!, BBjString mask!)
- if(#hasColumn(field!)) then
- #getColumn(field!).setColumnMask(mask!)
- FI
- methodend
- rem /**
- rem * Set an image list for a given column using GxRendererImageRenderer.
- rem *
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem *
- rem * Note: This method will override the CellRenderer of the column.
- rem * The column has to contain the values "1","2","3" to x to reference the slices in the BBjImage list
- rem *
- rem * @param BBjString field! The column's field
- rem * @param BBjImage imagelist! The image list containing the image sprites
- rem */
- method public void setColumnImageList(BBjString field!, BBjImage imagelist!)
- if #hasColumn(field!) then
- renderer! = new GxRendererImageRenderer()
- enc! = java.util.Base64.getEncoder()
- for i=1 to int(imageList!.getWidth() / imageList!.getHeight())
- imageSlice!=imageList!.getImageSlice(i-1,imageList!.getHeight())
- bytes$ = imageSlice!.getBytes("png")
- b64$ = enc!.encode(bytes$)
- renderer!.getList().addProperty(str(i-1),"data:image/png;base64, "+b64$)
- next
- rem adding a clear pixel to reflect the -1 for backwards compatibility to legacy BBj grid
- clearpixel$=enc!.encode($89504E470D0A1A0A0000000D4948445200000001000000010804000000B51C0C020000000B49444154789C63FACF0000020701029A1C31710000000049454E44AE426082$)
- renderer!.getList().addProperty("-1","data:image/png;base64, "+clearpixel$)
- #getColumn(field!).setCellRenderer(renderer!)
- FI
- methodend
- rem /**
- rem * Set an aggregation function for the passed column field
- rem *
- rem *
#Enterprise
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem * @param BBjString field! The column's field
- rem * @param BBjString AggFunc! Name of function to use for aggregation. One of [sum,min,max,first,last].
- rem */
- method public void setColumnAggFunc(BBjString field! , BBjString AggFunc!)
- if(#hasColumn(field!)) then
- #getColumn(field!).setAggFunc(AggFunc!)
- FI
- methodend
- rem /**
- rem * Enable row grouping for columns
- rem *
- rem *
#Enterprise
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @param BBjString columns! A comma separated string of column fields
- rem */
- method public void addRowGroupColumns(BBjString columns!)
- #getExecutor().execute("$wnd.gw_addRowGroupColumn('" + #getRootId() + "','" + columns! + "', 0 );")
- list! = Arrays.asList(columns!.split(","))
- it! = list!.iterator()
- count! = 0
- WHILE (it!.hasNext())
- next! = #getColumn(cvs(it!.next(),128))
- next!.setRowGroup(1)
- next!.setEnableRowGroup(1)
- next!.setRowGroupIndex(count!)
- count! = count! + 1
- WEND
- methodend
- rem /**
- rem * Disable row grouping for all columns and enable it for the passed columns
- rem *
- rem *
#Enterprise
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @param BBjString columns! A comma separated string of column fields
- rem */
- method public void setRowGroupColumns(BBjString columns!)
- #getExecutor().execute("$wnd.gw_addRowGroupColumn('" + #getRootId() + "','" + columns! + "' , 1);")
- list! = Arrays.asList(columns!.split(","))
- it! = #getColumnsManager().getColumns().entrySet().iterator()
- count! = 0
- WHILE (it!.hasNext())
- next! = cast(GxColumn , it!.next().getValue())
-
- if(list!.contains(next!.getField())) then
- next!.setRowGroup(1)
- next!.setEnableRowGroup(1)
- next!.setRowGroupIndex(count!)
- count! = count! + 1
- else
- next!.setRowGroup(0)
- next!.setEnableRowGroup(0)
- next!.setRowGroupIndex(null())
- FI
- WEND
- methodend
- rem /**
- rem * Disable row grouping for columns.
- rem *
- rem *
#Enterprise
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @param BBjString columns! A comma separated string of column fields
- rem */
- method public void removeRowGroupColumns(BBjString columns!)
- #getExecutor().execute("$wnd.gw_removeRowGroupColumn('" + #getRootId() + "','" + columns! + "');")
- list! = Arrays.asList(columns!.split(","))
- it! = list!.iterator()
- WHILE (it!.hasNext())
- next! = #getColumn(cvs(it!.next(),128))
- next!.setRowGroup(0)
- next!.setEnableRowGroup(0)
- next!.setRowGroupIndex(null())
- WEND
- methodend
- rem /**
- rem * Enable pivot for columns
- rem *
- rem *
#Enterprise
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @param BBjString columns! A comma separated string of column fields
- rem */
- method public void addPivotColumns(BBjString columns!)
- #getExecutor().execute("$wnd.gw_addPivotColumns('" + #getRootId() + "','" + columns! + "', 0 );")
- list! = Arrays.asList(columns!.split(","))
- it! = list!.iterator()
- count! = 0
- WHILE (it!.hasNext())
- next! = #getColumn(cvs(it!.next(),128))
- next!.setEnablePivot(1)
- next!.setPivotIndex(count!)
- count! = count! + 1
- WEND
- methodend
- rem /**
- rem * Disable pivot for all columns and enable it for the passed columns
- rem *
- rem *
#Enterprise
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @param BBjString columns! A comma separated string of column fields
- rem */
- method public void setPivotColumns(BBjString columns!)
- #getExecutor().execute("$wnd.gw_addPivotColumns('" + #getRootId() + "','" + columns! + "' , 1);")
- list! = Arrays.asList(columns!.split(","))
- it! = #getColumnsManager().getColumns().entrySet().iterator()
- count! = 0
- WHILE (it!.hasNext())
- next! = cast(GxColumn , it!.next().getValue())
-
- if(list!.contains(next!.getField())) then
- next!.setEnablePivot(1)
- next!.setPivotIndex(count!)
- count! = count! + 1
- else
- next!.setEnablePivot(0)
- next!.setPivotIndex(null())
- FI
- WEND
- methodend
- rem /**
- rem * Disable pivot for columns.
- rem *
- rem *
#Enterprise
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @param BBjString columns! A comma separated string of column fields
- rem */
- method public void removePivotColumns(BBjString columns!)
- #getExecutor().execute("$wnd.gw_removePivotColumns('" + #getRootId() + "','" + columns! + "');")
- list! = Arrays.asList(columns!.split(","))
- it! = list!.iterator()
- WHILE (it!.hasNext())
- next! = #getColumn(cvs(it!.next(),128))
- next!.setEnablePivot(0)
- next!.setPivotIndex(null())
- WEND
- methodend
- rem /**
- rem * Enable value for columns
- rem *
- rem *
#Enterprise
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @param BBjString columns! A comma separated string of column fields
- rem */
- method public void addValueColumns(BBjString columns!)
- #getExecutor().execute("$wnd.gw_addValueColumns('" + #getRootId() + "','" + columns! + "');")
- list! = Arrays.asList(columns!.split(","))
- it! = list!.iterator()
- WHILE (it!.hasNext())
- next! = cvs(it!.next(),128)
- #getColumn(next!).setEnableValue(1)
- WEND
- methodend
- rem /**
- rem * Disable value for columns.
- rem *
- rem *
#Enterprise
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @param BBjString columns! A comma separated string of column fields
- rem */
- method public void removeValueColumns(BBjString columns!)
- #getExecutor().execute("removeValueColumns('" + #getRootId() + "','" + columns! + "');")
- list! = Arrays.asList(columns!.split(","))
- it! = list!.iterator()
- WHILE (it!.hasNext())
- next! = cvs(it!.next(),128)
- #getColumn(next!).setEnableValue(0)
- WEND
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public GxColumnGroup addColumnGroup(GxColumnGroup definition!)
- methodret #getColumnsManager().addColumnGroup(definition!)
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public GxColumnGroup addColumnGroup(BBjString id!)
- methodret #getColumnsManager().addColumnGroup(id!)
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public GxColumnGroup addColumnGroup(BBjString id! , BBjString label!)
- methodret #getColumnsManager().addColumnGroup(id!,label!)
- methodend
- rem /**
- rem * Add column group
- rem *
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem * @param BBjString id! The group id
- rem * @param BBjString label! The group label/name
- rem * @param BBjVector columns! Vector of columns ids/fields to use
- rem * @param BBjNumber marryChildren! Set to 'true' to keep columns in this group beside each other in the grid.
- rem * Moving the columns outside of the group (and hence breaking the group) is not allowed.
- rem * @param BBjString headerClass! A CSS class to apply
- rem *
- rem * @return GxColumnGroup The GxColumnGroup instance
- rem */
- method public GxColumnGroup addColumnGroup(BBjString id! , BBjString label! , BBjVector columns! , BBjNumber marryChildren! ,BBjString headerClass! )
- declare GxColumnGroup definition!
-
- definition! = new GxColumnGroup(id! , label!)
- definition!.setMarryChildren(marryChildren!)
- definition!.getHeaderClass().add(headerClass!)
- columnsLength! = columns!.size() - 1
- FOR i = 0 TO columnsLength!
- current$ = columns!.get(i)
- column! = null()
-
- if(#hasColumn(current$)) then
- column! = #getColumn(current$)
- else
- column! = #addColumn(current$,current$)
- FI
-
- definition!.addColumn(column!)
- #removeColumn(current$)
- NEXT i
-
- methodret #addColumnGroup(definition!)
- methodend
- rem /**
- rem * Group Vector of Columns
- rem *
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem * @param BBjString id! The group id
- rem * @param BBjString label! The group label/name
- rem * @param BBjVector columns! Vector of columns ids/fields to use
- rem * @param BBjNumber marryChildren! Set to 'true' to keep columns in this group beside each other in the grid.
- rem * Moving the columns outside of the group (and hence breaking the group) is not allowed.
- rem *
- rem * @return GxColumnGroup The GxColumnGroup instance
- rem */
- method public GxColumnGroup addColumnGroup(BBjString id!, BBjString label! , BBjVector columns! , BBjNumber marryChildren!)
- methodret #addColumnGroup(id!,label!,columns! , marryChildren! , "" )
- methodend
- rem /**
- rem * Group Vector of Columns
- rem *
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem * @param BBjString id! The group id
- rem * @param BBjString name! The group label/name
- rem * @param BBjVector columns! Vector of columns ids/fields to use
- rem *
- rem * @return GxColumnGroup The GxColumnGroup instance
- rem */
- method public GxColumnGroup addColumnGroup(BBjString id! , BBjString label!, BBjVector columns!)
- methodret #addColumnGroup(id!,label! , columns! , 1 , "" )
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public GxColumnGroup getColumnGroup(BBjString id!)
- methodret #getColumnsManager().getColumnGroup(id!)
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public BBjNumber hasColumnGroup(BBjString id!)
- methodret #getColumnsManager().hasColumnGroup(id!)
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public GxColumnGroup removeColumnGroup(BBjString id!)
- methodret #getColumnsManager().removeColumnGroup(id!)
- methodend
- rem /**
- rem * {@inheritDoc}
- rem */
- method public void resetAllColumns()
- #getColumnsManager().resetAllColumns()
- methodend
- rem /**
- rem * Alias for resetAllColumns()
- rem *
- rem *
#Configuration
- rem *
#ColumnsRenderer
- rem *
- rem * @see resetAllColumns()
- rem */
- method public void clearColumnDefinitions()
- #resetAllColumns()
- methodend
- rem /**
- rem * Build the grid json configuration object
- rem *
- rem * @return JsonObject The grid options as JsonObject
- rem */
- method public JsonObject getAsJsonObject()
- REM build the column definition
- iterator! = #getColumnsManager().getColumns().entrySet().iterator()
- cdef! = new JsonArray()
- while iterator!.hasNext()
- next! = iterator!.next()
- key! = next!.getKey()
- value! = next!.getValue()
- cdef!.add(value!.getAsJsonObject())
- wend
-
- options! = #getOptions().getAsJsonObject()
- rem Columns options
- rem ===========================
- options!. add("columnDefs",cdef!)
- rem Context
- rem ===========================
- context! = options!.get("context").getAsJsonObject()
- context!.addProperty("id",#getRootId())
- context!. add("interests",iff(#getInterests().size() <> 0 ,#getInterests(), listIsEmpty!) ,err=*next)
- context!.addProperty("getRowNodeId",#RowNodeId$, err=*next)
-
- if(#getOptions().getEnableCharts() <> null() and #getOptions().getEnableCharts() = 1) then
- context!.add("chartToolbarItems",#getChartToolbarItems(), err=*next)
- FI
-
- methodret options!
- methodend
- rem /**
- rem * Render the grid
- rem *
- rem * The method will compose the grid config and send it to the client for a full re-render.
- rem * You can use this method to force the client render after you update a setup configuration (ex: column definitions)
- rem */
- method public void render()
- isWidgetReady! = #getIsReady()
- rem /**
- rem * Make sure to delay rendering until the widget is declared ready
- rem *
- rem * The widget is declared ready when the HTMLView fires the ON_PAGE_LOADED
- rem * event and the scripts are injected successfully
- rem */
- if(!isWidgetReady!)
- methodret
- FI
-
- isFirstRender! = #getIsFirstRender()
- gson! = new Gson()
- options! = #getAsJsonObject()
- data$ = #getRS().toJson(1 , #getRowNodeId())
- rem /**
- rem * The script priority is defined based on isFirstRender
- rem *
- rem * When the grid is rendering for the first time , we make sure
- rem * that the init script is the first one in the queue before any
- rem * other script. if is not the first render , then the init
- rem * is queued in the normal order.
- rem */
- priority! = 0
-
- if(!isFirstRender!)
- priority! = null()
- FI
-
- #getExecutor().execute("$wnd.gw_init(" + gson!.toJson(options!) + ",'" + #LicenseKey$ + "'," + data$ + ")" , 1 , priority!)
- rem /**
- rem * Update the IsFirstRender flag once and only once
- rem */
- if(!isFirstRender!)
- #setIsFirstRender(BBjAPI.FALSE)
- FI
- methodend
- rem /**
- rem * Re-render the column definitions on the client.
- rem *
- rem *
#API
- rem *
- rem * The method will collect the new changes in columns and column groups and force the client to reflect the
- rem * change.
- rem */
- method public void updateColumns()
- definition! = #getAsJsonObject().get("columnDefs").getAsJsonArray()
- scriptKey! = "$wnd.gw_setColumnDefinitions"
- #getExecutor().execute(scriptKey!,"$wnd.gw_setColumnDefinitions('" + #getRootId() + "'," + new Gson().toJson(definition!) + ")")
- methodend
- rem /**
- rem * Set a result set of pinned rows on top
- rem *
- rem * @param ResultSet rs! A ResultSet instance
- rem */
- method public void setPinnedTopRows(ResultSet rs!)
- #getOptions().setPinnedTopRows(rs!)
-
- if(#getIsReady())
- #getExecutor().execute("$wnd.gw_setPinnedTopRowData('" + #getRootId() + "'," + #getOptions().getPinnedTopRowsAsJson() + ")")
- fi
- methodend
- rem /**
- rem * Get the pinned top rows as defined in the grid options
- rem *
- rem * @return ResultSet The pinned rows
- rem */
- method public ResultSet getPinnedTopRows()
- methodret #getOptions().getPinnedTopRows()
- methodend
- rem /**
- rem * Get the count of pinned rows on top
- rem *
- rem * @param BBjNumber rows count
- rem */
- method public BBjNumber getPinnedTopRowsCount()
- rs! = #getOptions().getPinnedTopRows()
- count! = 0
-
- if(rs! <> null())
- count! = rs!.count()
- fi
-
- methodret count!
- methodend
- rem /**
- rem * Set a result set of pinned rows on bottom
- rem *
- rem * @param ResultSet rs! A ResultSet instance
- rem */
- method public void setPinnedBottomRows(ResultSet rs!)
- #getOptions().setPinnedBottomRows(rs!)
-
- if(#getIsReady())
- #getExecutor().execute("$wnd.gw_setPinnedBottomRowData('" + #getRootId() + "'," + #getOptions().getPinnedBottomRowsAsJson() + ")")
- fi
- methodend
- rem /**
- rem * Get the pinned bottom rows as defined in the grid options
- rem *
- rem * @return ResultSet The pinned rows
- rem */
- method public ResultSet getPinnedBottomRows()
- methodret #getOptions().getPinnedBottomRows()
- methodend
- rem /**
- rem * Get the count of pinned rows on bottom
- rem *
- rem * @param BBjNumber rows count
- rem */
- method public BBjNumber getPinnedBottomRowsCount()
- rs! = #getOptions().getPinnedBottomRows()
- count! = 0
-
- if(rs! <> null())
- count! = rs!.count()
- fi
-
- methodret count!
- methodend
- rem /**
- rem * Build the column definitions from the passed ResultSet
- rem *
- rem * @param ResultSet rs! ResultSet with the data
- rem *
- rem * @param BBjNumber addAll! When true, We will create a column definition for every column in the ResultSet, otherwise update the existing ones only
- rem */
- method public void buildColumnsFromResultSet(ResultSet rs! , BBjNumber addAll!)
- if rs! <> NULL() then
- fields! = rs!.getColumnNames()
- iterator! = fields!.iterator()
- while iterator!.hasNext()
- field$ = iterator!.next()
- meta! = rs!.getColumnMetaData(field$)
-
- if #hasColumn(field$) = 1 then
- #getColumn(field$).update(meta! , #getOptions().getDefaultColumnDefinition())
+
+ if(jsonModel! <> null() AND jsonModel! <> "null")
+ methodret #getClientJsonFactory().getFilter(jsonModel!,column!)
else
- if(addAll! = 1) then
- definition! = new GxColumn(field$)
- definition!.update(meta!, #getOptions().getDefaultColumnDefinition())
- #addColumn(definition!)
- FI
+ model! = null()
+ rem we try to detect the filter type and create its model
+ if (#getColumn(column!).getFilter() <> null())
+ filterName! = #getColumn(column!).getFilter().getFilterName()
+ SWITCH (filterName!)
+ CASE GxFilterNumber.getFilterName()
+ model! = new GxClientFilterNumberModel()
+ break
+ CASE GxFilterBasicTimestamp.getFilterName()
+ model! = new GxClientFilterDateTimeModel()
+ break
+ CASE GxFilterBasicBoolean.getFilterName()
+ model! = new GxClientFilterBooleanModel()
+ break
+ CASE GxFilterText.getFilterName()
+ model! = new GxClientFilterTextModel()
+ break
+ CASE GxFilterSetFilter.getFilterName()
+ model! = new GxClientFilterSetFilterModel()
+ break
+ SWEND
+ FI
+
+ if(model! = null())
+ throw "Failed to create column filter's model. The column has no filter component attached" , 256
+ FI
+
+ model!.setWidget(#this!)
+ model!.setColumn(column!)
+ methodret model!
FI
- wend
- FI
- methodend
- rem /**
- rem * Feed the grid with data
- rem *
- rem * @param ResultSet rs! ResultSet with the data
- rem * @param BBjNumber render! When true the grid will render directly on the client, otherwise you need to call render() directly
- rem * @param BBjNumber addAll! When true, We will create a column definition for every column in the ResultSet, otherwise update the existing ones only
- rem * @param BBjString indexdBy$ The field used for creating the unique row index
- rem *
- rem * @see render()
- rem */
- method public void setData(ResultSet rs!,BBjNumber render! , BBjNumber addAll! , BBjString indexdBy$)
- #RowNodeId$ = indexdBy$
- #RS! = rs!
-
- if rs! <> NULL() then
- #buildColumnsFromResultSet(rs!,addAll!)
- #RS!.createIndex()
- FI
-
- #render()
- methodend
- rem /**
- rem * Feed the grid with data
- rem *
- rem * The method will sync the result set column definitions with the current column definitions ,
- rem * update the data and render the grid on the client
- rem *
- rem * @param ResultSet rs! ResultSet with the data
- rem * @param BBjNumber render! When true the grid will render directly on the client, otherwise you need to call render() directly
- rem * @param BBjNumber addAll! When true, We will create a column definition for every column in the ResultSet, otherwise update the existing ones only
- rem *
- rem * @see render()
- rem */
- method public void setData( ResultSet rs! , BBjNumber render!, BBjNumber all!)
- #setData(rs! , render! , all! , #getRowNodeId())
- methodend
- rem /**
- rem * Feed the grid with data
- rem *
- rem * The method will sync the result set column definitions with the current column definitions ,
- rem * update the data and render the grid on the client
- rem *
- rem * @param ResultSet rs! ResultSet with the data
- rem * @param BBjNumber render! When true the grid will render directly on the client, otherwise you need to call render() directly
- rem *
- rem * @see render()
- rem */
- method public void setData( ResultSet rs! , BBjNumber render!)
- #setData(rs! , render! , 1 , #getRowNodeId())
- methodend
- rem /**
- rem * Feed the grid with data
- rem *
- rem * @param ResultSet rs! ResultSet with the data
- rem * @param BBjString indexdBy$ The field used for creating the unique row index
- rem */
- method public void setData(ResultSet rs!, BBjString indexdBy$)
- #setData(rs! , 1 , 1 , indexdBy$)
- methodend
- rem /**
- rem * Feed the grid with data
- rem *
- rem * The method will sync the result set column definitions with the current column definitions ,
- rem * update the data and render the grid on the client
- rem *
- rem * @param ResultSet rs! ResultSet with the data
- rem */
- method public void setData( ResultSet rs!)
- #setData(rs! , 1)
- methodend
- rem /**
- rem * Feed the grid with a new ResultSet
- rem *
- rem * Unlike the setData method, this one will update the grid with a new rows set(ResultSet) without doing a full re-render.
- rem * The column definition will not be synced from the passed ResultSet in this case.
- rem *
- rem * Use this method in case you want to replace the whole data in the grid at once.
- rem * Please note that All row and range selection will be lost.
- rem *
- rem *
#API
- rem *
- rem * @param ResultSet rs! ResultSet with the data
- rem *
- rem * @see setData()
- rem */
- method public void updateData(ResultSet rs!)
- #RS! = rs!
-
- if rs! <> NULL() AND rs!.size() > 0 then
- #RS!.createIndex(err=*next)
- data$=#RS!.toJson(BBjAPI.TRUE,#getRowNodeId())
- scriptKey! = "$wnd.gw_setRowData"
- #getExecutor().execute(scriptKey!,"$wnd.gw_setRowData('" + #getRootId() + "'," + data$+ ")")
- FI
- methodend
- rem /**
- rem * Feed the grid with a new ResultSet
- rem *
- rem * Unlike the setData method, this one will update the grid with a new rows set(ResultSet) without doing a full re-render.
- rem * The column definition will not be synced from the passed ResultSet in this case.
- rem *
- rem * Use this method in case you want to replace the whole data in the grid at once.
- rem * Please note that All row and range selection will be lost.
- rem *
- rem *
#API
- rem *
- rem * @param ResultSet rs! ResultSet with the data
- rem *
- rem * @see setData()
- rem *
- rem * @deprecated since version 0.101.0, BBjGridExWidget.setRowsData(ResultSet rs!) is deprecated / renamed. Use BBjGridExWidget.updateData(ResultSet rs!) instead.
- rem */
- method public void setRowsData(ResultSet rs!)
- GxLogger.warn("since version 0.101.0, BBjGridExWidget.setRowsData(ResultSet rs!) is deprecated / renamed. Use BBjGridExWidget.updateData(ResultSet rs!) instead.")
- #updateData(rs!)
- methodend
- rem /**
- rem * Execute a bulk update on the grid
- rem *
- rem * The transaction method is to pass a transaction object to the grid containing
- rem * rows to add, remove and update.
- rem *
- rem * The grid keeps all active sorting, grouping and filtering, including updating to reflect
- rem * the changes in the data should the sorting, grouping or filtering be impacted.
- rem *
- rem * Updating using transactions is the best way to do large updates to the grid, as the grid treats them
- rem * as delta changes, so the grid only refreshes what is needed giving a performance boost.
- rem *
- rem * All row and range selection will be kept.
- rem *
- rem * Note that all update done on the grid will reflected also on the ResultSet instance which is the grid
- rem * is using.
- rem *
- rem *
#API
- rem *
- rem * @param GxClientTransactionModel transaction!
- rem * @param BBjNumber batchUpdate! when true then execute the update, along with any other updates you subsequently provide
- rem */
- method public void executeUpdateTransaction(GxClientTransactionModel transaction!,BBjNumber batchUpdate!)
- transaction!.setWidget(#this!)
- json! = transaction!.execute()
- #getExecutor().execute("$wnd.gw_updateRowData('" + #getRootId() + "'," + json!.toString() + "," + str(batchUpdate!.booleanValue()) + ")")
- methodend
- rem /**
- rem * Execute a bulk update on the grid
- rem *
- rem * The transaction method is to pass a transaction object to the grid containing
- rem * rows to add, remove and update.
- rem *
- rem * The grid keeps all active sorting, grouping and filtering, including updating to reflect
- rem * the changes in the data should the sorting, grouping or filtering be impacted.
- rem *
- rem * Updating using transactions is the best way to do large updates to the grid, as the grid treats them
- rem * as delta changes, so the grid only refreshes what is needed giving a performance boost.
- rem *
- rem * All row and range selection will be kept.
- rem *
- rem * Note that all update done on the grid will reflected also on the ResultSet instance which is the grid
- rem * is using.
- rem *
- rem *
#API
- rem *
- rem * @param GxClientTransactionModel transaction!
- rem */
- method public void executeUpdateTransaction(GxClientTransactionModel transaction!)
- #executeUpdateTransaction(transaction! , 0)
- methodend
- rem /**
- rem * Update row data
- rem *
- rem *
#API
- rem *
- rem * @param DataRow row! DataRow object which contains the update
- rem *
- rem * @return GxClientTransactionModel the transaction object which used to achieve the update
- rem */
- method public GxClientTransactionModel updateRow(DataRow row!)
- transaction! = new GxClientTransactionModel()
- transaction!.update(row!)
- #executeUpdateTransaction(transaction!)
- methodret transaction!
- methodend
- rem /**
- rem * Update row data
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber index! The Row index
- rem * @param DataRow row! DataRow object which contains the update
- rem *
- rem * @return GxClientTransactionModel the transaction object which used to achieve the update
- rem *
- rem * @deprecated since version 0.101.0, BBjGridExWidget.updateRow(BBjNumber index!,DataRow row!) is deprecated. Use BBjGridExWidget.updateRow(DataRow row!) instead. The grid can work out the row index by its own
- rem */
- method public GxClientTransactionModel updateRow(BBjNumber index!,DataRow row!)
- GxLogger.warn("since version 0.101.0, BBjGridExWidget.updateRow(BBjNumber index!,DataRow row!) is deprecated. Use BBjGridExWidget.updateRow(DataRow row!) instead. The grid can work out the row index by its own")
- methodret #updateRow(row!)
- methodend
- rem /**
- rem * Update row data
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber index! The Row index
- rem * @param DataRow row! DataRow object which contains the update
- rem *
- rem * @return GxClientTransactionModel the transaction object which used to achieve the update
- rem *
- rem * @deprecated since version 0.101.0, BBjGridExWidget.setRowData(BBjNumber index!,DataRow row!) is deprecated. Use BBjGridExWidget.updateRow(DataRow row!) instead. The grid can work out the row index by its own
- rem */
- method public GxClientTransactionModel setRowData(BBjNumber index!,DataRow row!)
- GxLogger.warn("since version 0.101.0, BBjGridExWidget.setRowData(BBjNumber index!,DataRow row!) is deprecated. Use BBjGridExWidget.updateRow(DataRow row!) instead. The grid can work out the row index by its own")
- methodret #updateRow(index!,row!)
- methodend
- rem /**
- rem * Update row data
- rem *
- rem *
#API
- rem *
- rem * @param DataRow row! DataRow object which contains the update
- rem *
- rem * @return GxClientTransactionModel the transaction object which used to achieve the update
- rem *
- rem * @deprecated since version 0.101.0, BBjGridExWidget.setRowData(DataRow row!) is deprecated. Use BBjGridExWidget.updateRow(DataRow row!) instead. The grid can work out the row index by its own
- rem */
- method public GxClientTransactionModel setRowData(DataRow row!)
- GxLogger.warn("since version 0.101.0, BBjGridExWidget.setRowData(DataRow row!) is deprecated. Use BBjGridExWidget.updateRow(DataRow row!) instead. The grid can work out the row index by its own")
- methodret #updateRow(row!)
- methodend
- rem /**
- rem * Add new row
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber index! The insert index
- rem * @param DataRow row! DataRow object which contains the update
- rem *
- rem * @return GxClientTransactionModel the transaction object which used to achieve the update
- rem */
- method public GxClientTransactionModel addRow(BBjNumber index!,DataRow row!)
- transaction! = new GxClientTransactionModel()
- transaction!.add(row!)
- transaction!.setAddIndex(index!)
- #executeUpdateTransaction(transaction!)
- methodret transaction!
- methodend
- rem /**
- rem * Add new row at the beginning of the grid
- rem *
- rem *
#API
- rem *
- rem * @param DataRow row! The DataRow object which contains the update
- rem *
- rem * @return GxClientTransactionModel the transaction object which used to achieve the update
- rem */
- method public GxClientTransactionModel addRow(DataRow row!)
- methodret #addRow(0,row!)
- methodend
- rem /**
- rem * Remove a row from grid by the row reference
- rem *
- rem *
#API
- rem *
- rem * @param DataRow row! The data row object to remove
- rem *
- rem * @return GxClientTransactionModel the transaction object which used to achieve the update
- rem */
- method public GxClientTransactionModel removeRow(DataRow row!)
- transaction! = new GxClientTransactionModel()
- transaction!.remove(row!)
- #executeUpdateTransaction(transaction!)
- methodret transaction!
- methodend
- rem /**
- rem * Remove a row from grid by index
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber index! The row index
- rem *
- rem * @return GxClientTransactionModel the transaction object which used to achieve the update
- rem */
- method public GxClientTransactionModel removeRow(BBjNumber index!)
- methodret #removeRow(#getRS().get(index!))
- methodend
- rem /**
- rem * Remove a row from grid by key
- rem *
- rem *
#API
- rem *
- rem * @param BBjString key! The row key
- rem *
- rem * @return GxClientTransactionModel the transaction object which used to achieve the update
- rem */
- method public GxClientTransactionModel removeRow(BBjString key!)
- methodret #removeRow(#getRS().get(key!))
- methodend
- rem /**
- rem * Clear row data (Empty the grid )
- rem *
- rem *
#API
- rem */
- method public void clearData()
- #getRS().clear()
-
- if(#IsReady!) then
- #getExecutor().execute("$wnd.gw_setRowData('" + #getRootId() + "', [])",0)
- fi
- methodend
- rem /**
- rem * Clear row data (Empty the grid )
- rem *
- rem *
#API
- rem *
- rem * @deprecated since version 0.101.0, BBjGridExWidget.clearRowsData() is deprecated / renamed. Use BBjGridExWidget.clearData() instead.
- rem */
- method public void clearRowsData()
- GxLogger.warn("since version 0.101.0, BBjGridExWidget.clearRowsData() is deprecated / renamed. Use BBjGridExWidget.clearData() instead.")
- #clearData()
- methodend
- rem /**
- rem * Apply the grid's columns , sorbing and filtering state
- rem *
- rem *
#API
- rem *
- rem * @param GxState state! : the state object
- rem */
- method public void setState(GxState state!)
- scriptKey! = "$wnd.gw_setState"
- #getExecutor().execute(scriptKey!,"$wnd.gw_setState('" + #getRootId() + "'," + state!.toString() +")")
- methodend
- rem /**
- rem * Apply the grid's columns , sorbing and filtering state
- rem *
- rem *
#API
- rem *
- rem * @param GxState state! : the state object
- rem *
- rem * @deprecated since version 0.101.0, BBjGridExWidget.setColumnState(GxState state!) is deprecated / renamed. Use BBjGridExWidget.setState(GxState state!) instead.
- rem */
- method public void setColumnState(GxState state!)
- GxLogger.warn("since version 0.101.0, BBjGridExWidget.setColumnState(GxState state!) is deprecated / renamed. Use BBjGridExWidget.setState(GxState state!) instead.")
- #setState(state!)
- methodend
- rem /**
- rem * Get the grid's columns , sorting and filtering state
- rem *
- rem *
#API
- rem *
- rem * @returns GxState
- rem */
- method public GxState getState()
- state! = new GxState()
- json_string$ = str(#getExecutor().execute("$wnd.gw_getState('" + #getRootId() + "')",0))
- state!.setString(json_string$)
- methodret state!
- methodend
- rem /**
- rem * Get the grid's columns , sorting and filtering state
- rem *
- rem *
#API
- rem *
- rem * @returns GxState
- rem *
- rem * @deprecated since version 0.101.0, BBjGridExWidget.getColumnState() is deprecated / renamed. Use BBjGridExWidget.getState() instead.
- rem */
- method public GxState getColumnState()
- GxLogger.warn("since version 0.101.0, BBjGridExWidget.getColumnState() is deprecated / renamed. Use BBjGridExWidget.getState() instead.")
- methodret #getState()
- methodend
- rem /**
- rem * Get the grid sidebar instance
- rem *
- rem * @return GxSidebar
- rem */
- method public GxSidebar getSidebar()
- methodret #getOptions().getSidebar()
- methodend
- rem /**
- rem * Get the language manager instance
- rem *
- rem * @returns GxLanguageManager
- rem */
- method public GxLanguageManager getLanguageManager()
- methodret #getOptions().getLanguageManager()
- methodend
- rem /**
- rem * Get the grid statusbar instance
- rem *
- rem * @return GxStatusBar
- rem */
- method public GxStatusBar getStatusbar()
- methodret #getOptions().getStatusbar()
- methodend
- rem /**
- rem * Get the grid default context menu
- rem *
- rem * @return GxContextMenu
- rem */
- method public GxContextMenu getContextMenu()
- methodret #getOptions().getContextMenu()
- methodend
- rem /**
- rem * Get the grid's client context
- rem *
- rem * @return JsonObject
- rem */
- method public JsonObject getClientContext()
- methodret #getOptions().getClientContext()
- methodend
- rem /**
- rem * Get instance of GxClientJsonFactory
- rem *
- rem * @return GxClientJsonFactory
- rem */
- method public GxClientJsonFactory getClientJsonFactory()
- methodret #ClientJsonFactory!
- methodend
- rem /**
- rem * Add Style block
- rem *
- rem *
#API
- rem *
- rem * @param selector$ : Css Selector
- rem * @param rules! : Css Rules object as json object
- rem */
- method public void addStyle(BBjString selector$ , JsonObject rules! )
- #getExecutor().execute("$wnd.gw_setStyle('" + selector$ + "','" + rules!.toString() + "')")
- methodend
- rem /**
- rem * Add Style block
- rem *
- rem *
#API
- rem *
- rem * @param selector$ : Css Selector
- rem * @param rules! : Css Rules object as string
- rem */
- method public void addStyle(BBjString selector$ , BBjString rules! )
- #getExecutor().execute("$wnd.gw_setStyle('" + selector$ + "','" + rules! + "')")
- methodend
- rem /**
- rem * Remove Style Block
- rem *
- rem *
#API
- rem *
- rem * @param selector$ : Css Selector
- rem */
- method public Boolean removeStyle(BBjString selector$)
- #getExecutor().execute("$wnd.gw_removeStyle('" + selector$ + "')")
- methodret BBjAPI.TRUE
- methodend
- rem /**
- rem * Set the grid theme
- rem *
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @param BBjString theme$
- rem *
- rem * @see getThemes()
- rem * @see GRID_THEME_BALHAM()
- rem * @see GRID_THEME_BALHAM_DARK()
- rem * @see GRID_THEME_MATERIAL()
- rem */
- method public void setTheme(BBjString theme$)
- #getOptions().setTheme(theme$)
-
- if(#IsReady!) then
- if info(3,6)>"4" then
- s$="$doc.getElementById('" + str(#getRootId()) + "').className='ag-theme-"+theme$+"';"
- else
- s$="document.getElementById('" + str(#getRootId()) + "').className='ag-theme-"+theme$+"';"
- FI
-
- #getExecutor().execute(s$)
- else
- template! = #getTemplate()
- #HTMLView!.setText(template!)
- FI
- methodend
- rem /**
- rem * Get the grid supported themes
- rem *
- rem *
#API
- rem *
- rem * @return BBjVector array of theme names
- rem *
- rem * @see GRID_THEME_BALHAM()
- rem * @see GRID_THEME_BALHAM_DARK()
- rem * @see GRID_THEME_MATERIAL()
- rem */
- method public BBjVector getThemes()
- v! = new BBjVector()
- v!.addItem(#GRID_THEME_ALPINE())
- v!.addItem(#GRID_THEME_ALPINE_DARK())
- v!.addItem(#GRID_THEME_BALHAM())
- v!.addItem(#GRID_THEME_BALHAM_DARK())
- v!.addItem(#GRID_THEME_MATERIAL())
- methodret v!
- methodend
- rem /**
- rem * Enable a chart toolbar item
- rem *
- rem *
#Enterprise
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @see CHART_TOOLBAR_SETTINGS()
- rem * @see CHART_TOOLBAR_DATA()
- rem * @see CHART_TOOLBAR_FORMAT()
- rem * @see CHART_TOOLBAR_DOWNLOAD()
- rem */
- method public void addChartToolbarItem(BBjString item!)
- #ChartToolbarItems!.add(item!)
-
- if(#IsReady! and (#getOptions().getEnableCharts() <> null() and #getOptions().getEnableCharts() = 1)) then
- #getClientContext().add("chartToolbarItems",#getChartToolbarItems())
- #updateContext()
- FI
- methodend
- rem /**
- rem * Disable a chart toolbar item
- rem *
- rem *
#Enterprise
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @see CHART_TOOLBAR_SETTINGS()
- rem * @see CHART_TOOLBAR_DATA()
- rem * @see CHART_TOOLBAR_FORMAT()
- rem * @see CHART_TOOLBAR_DOWNLOAD()
- rem */
- method public void removeChartToolbarItem(BBjString item!)
- el! = new JsonPrimitive(item!)
-
- if #ChartToolbarItems!.contains(el!) then
- #ChartToolbarItems!.remove(el!)
- FI
-
- if(#IsReady! and (#getOptions().getEnableCharts() <> null() and #getOptions().getEnableCharts() = 1)) then
- #getClientContext().add("chartToolbarItems",#getChartToolbarItems())
- #updateContext()
- FI
- methodend
- rem /**
- rem * Set the focus on the given row id and the given column
- rem *
- rem *
#API
- rem * @param BBjString row! The row id
- rem * @param BBjString column! The column id
- rem * @param BBjString floating! The row floating (top , bottom or none)
- rem *
- rem * @see BBjGridExWidget.GRID_FLOATING_NONE()
- rem * @see BBjGridExWidget.GRID_FLOATING_TOP()
- rem * @see BBjGridExWidget.GRID_FLOATING_BOTTOM()
- rem */
- method public void focus(BBjString row! , BBjString column! , BBjString floating!)
- rem DO NOT focus the canvas or the we will have an infinite focus calls
- rem #super!.focus()
-REM if info(3,6)<>"6" then
- if #getCanvas().getParentWindow().getFocusedControlID() <> #getCanvas().getID() then
- #getHTMLView().clearCallback(BBjAPI.ON_GAINED_FOCUS)
- #HTMLView!.focus()
- #getHTMLView().setCallback(BBjAPI.ON_GAINED_FOCUS,#this!,"onGainedFocus")
- FI
-REM endif
- rem /**
- rem * We never debounce the focus calls , this causes a heck of problems
- rem * when there are several grids rendered
- rem */
- script$="$wnd.gw_setFocusedCell('" + #getRootId() + "','" + str(row!) + "','" + str(column!) + "','" + str(floating!) +"');"
- #getExecutor().execute(script$)
- methodend
- rem /**
- rem * Set the focus on the given row id and the given column
- rem *
- rem *
#API
- rem * @param BBjString row! The row id
- rem * @param BBjString column! The column id
- rem */
- method public void focus(BBjString row! , BBjString column!)
- #focus(row!, column!, #GRID_FLOATING_NONE())
- methodend
- rem /**
- rem * Set the focus on the given row id and the first column
- rem *
- rem *
#API
- rem *
- rem * @param BBjString row! The row id
- rem */
- method public void focus(BBjString row!)
- #focus(row!, "")
- methodend
- rem /**
- rem * Set the focus on the given row id and the given column
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber row! The row id
- rem * @param BBjString column! The column id
- rem * @param BBjString floating! The row floating
- rem *
- rem * @see BBjGridExWidget.GRID_FLOATING_NONE()
- rem * @see BBjGridExWidget.GRID_FLOATING_TOP()
- rem * @see BBjGridExWidget.GRID_FLOATING_BOTTOM()
- rem */
- method public void focus(BBjNumber row!, BBjString column!, BBjString floating!)
- #focus(str(row!), column!, floating!)
- methodend
- rem /**
- rem * Set the focus on the given row id and the given column
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber row! The row id
- rem * @param BBjString column! The column id
- rem */
- method public void focus(BBjNumber row!, BBjString column!)
- #focus(row!, column!, #GRID_FLOATING_NONE())
- methodend
- rem /**
- rem * Set the focus on the given row id and the first column
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber row! The row id
- rem */
- method public void focus(BBjNumber row!)
- #focus(row!, "")
- methodend
- rem /**
- rem * Will set the focus on the first cell of the first row.
- rem * In case the grid has already a different selected cell , the the
- rem * method will retain this information.
- rem *
- rem *
#API
- rem */
- method public void focus()
- #focus(-1)
- methodend
- rem /**
- rem * Navigates the grid focus to the next cell, as if tabbing.
- rem *
- rem *
#API
- rem */
- method public void tabToNextCell()
- #getExecutor().execute("$wnd.gw_tabToNextCell('" + #getRootId() + "')")
- methodend
- rem /**
- rem * Navigates the grid focus to the previous cell, as if shift-tabbing.
- rem *
- rem *
#API
- rem */
- method public void tabToPreviousCell()
- #getExecutor().execute("$wnd.gw_tabToPreviousCell('" + #getRootId() + "')")
- methodend
- rem /**
- rem * select all rows
- rem *
- rem *
#API
- rem */
- method public void selectAll()
- scriptKey! = "$wnd.gw_selectAll"
- script$="$wnd.gw_selectAll('" + #getRootId() + "',0);"
- #getExecutor().execute(scriptKey!,script$)
- methodend
- rem /**
- rem * select all rows
- rem *
- rem *
#API
- rem *
- rem * @param BBJNumber x!: 0 select all, 1 select all filtered
- rem */
- method public void selectAll(BBjNumber x!)
- #deselectAll()
- scriptKey! = "$wnd.gw_selectAll"
- script$="$wnd.gw_selectAll('" + #getRootId() + "'," + str(x!) + ");"
- #getExecutor().execute(scriptKey!,script$)
- methodend
- rem /**
- rem * deselect all rows
- rem *
- rem *
#API
- rem */
- method public void deselectAll()
- scriptKey! = "$wnd.gw_deselectAll"
- script$="$wnd.gw_deselectAll('" + #getRootId() + "',0);"
- #getExecutor().execute(scriptKey!,script$)
- methodend
- rem /**
- rem * deselect all rows
- rem *
- rem *
#API
- rem *
- rem * @param BBJNumber x!: 0 deselect all, 1 deselect all filtered
- rem */
- method public void deselectAll(BBjNumber x!)
- scriptKey! = "$wnd.gw_deselectAll"
- script$="$wnd.gw_deselectAll('"+ #getRootId() + "'," + str(x!) + ");"
- #getExecutor().execute(scriptKey!,script$)
- methodend
- rem /**
- rem * Select a row by its index
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber x!: the row index to select
- rem */
- method public void setSelectedRow(BBjNumber index!)
- #setSelectedRow(str(index!))
- methodend
- rem /**
- rem * Select a row by its key
- rem *
- rem *
#API
- rem *
- rem * @param BBjString x!: the row key to select
- rem */
- method public void setSelectedRow(BBjString key!)
- script$="$wnd.gw_setSelectedRows('" + #getRootId() + "',['" + str(key!) + "']);"
- #getExecutor().execute(script$)
- methodend
- rem /**
- rem * Get the current selected row
- rem *
- rem *
#API
- rem *
- rem * @return GxClientRowModel The selected row if any, null() otherwise
- rem */
- method public GxClientRowModel getSelectedRow()
- returnedRow! = #getExecutor().execute("$wnd.gw_getSelectedRow('" + #getRootId() + "')",0)
- if returnedRow!<>null() and len(returnedRow!) > 0 then
- methodret #getClientJsonFactory().getRow(returnedRow!)
- FI
-
- methodret null()
- methodend
- rem /**
- rem * Select a vector of rows.
- rem * The vector can contain a mix of row indices and row keys
- rem *
- rem *
#API
- rem *
- rem * @param BBJNumber x!: vector of row indices and row keys to select
- rem */
- method public void setSelectedRows(BBjVector x!)
- script$="$wnd.gw_setSelectedRows('" + #getRootId() + "',["
- it! = x!.iterator()
- first=1
- while it!.hasNext()
- if first
- first=0
- else
- script$=script$+","
- FI
-
- script$ = script$ + "'" + str(it!.next()) + "'"
- wend
-
- script$=script$+"]);"
- #getExecutor().execute(script$)
- methodend
- rem /**
- rem * Get Array of selected rows
- rem *
- rem *
#API
- rem *
- rem * @return BBjVector A vector filled with the selected rows
- rem */
- method public BBjVector getSelectedRows()
- rows! = new BBjVector()
-
- if (#getRS() = null()) then
- goto getSelectedRowsErr
- FI
-
- returnedRows! = #getExecutor().execute("$wnd.gw_getSelectedRows('" + #getRootId() + "')" , 0)
- if returnedRows! = null() then
- goto getSelectedRowsErr
- FI
-
- parser! = new JsonParser()
- array! = parser!.parse(returnedRows!).getAsJsonArray()
- it! = array!.iterator()
- while (it!.hasNext())
- next! = it!.next().getAsJsonObject(err=getSelectedRowsErr)
- rows!.add(#getClientJsonFactory().getRow(next!))
- wend
-
- getSelectedRowsErr:
- methodret rows!
- methodend
- rem /**
- rem * Returns the row with the given key from the grid.
- rem *
- rem * Note : if you only need to get the row and
- rem * you don't care about other meta data like parent(when grouping) , isSelected,... then use the
- rem * ResultSet API (ex ResultSet.getItem(BBjString key!) )
- rem *
- rem * @param BBjString key! the row's key
- rem *
- rem * @return GxClientRowModel the grid's row model
- rem *
- rem * @see ResultSet.getItem
- rem */
- method public GxClientRowModel getRow(BBjString key!)
- returnedRow! = #getExecutor().execute("$wnd.gw_getRow('" + #getRootId() + "','" + key! + "')" , 0)
- if returnedRow! <> null() and len(returnedRow!) > 0 then
- methodret #getClientJsonFactory().getRow(returnedRow!)
- FI
-
- methodret null()
- methodend
- rem /**
- rem * Get the rows from grid in the given phase after applying the given
- rem * filter expression.
- rem *
- rem * Note: if you only need to get the whole rows from the grid and you don't care about
- rem * filtering and sorting Then retrieve them from ResultSet as this will be faster
- rem * especially in BUI
- rem *
- rem * @param BBjString phase! The rows phase
- rem * @param BBjString filterExpression! A filter expression to execute before returning the rows.
- rem * The expression must return true or false for the given row
- rem *
- rem * @return BBjVector A vector of GxClientRowModel(s)
- rem *
- rem * @see #GRID_ROWS_PHASE_ALL()
- rem * @see #GRID_ROWS_PHASE_AFTER_FILTER()
- rem * @see #GRID_ROWS_PHASE_AFTER_FILTER_SORT()
- rem *
- rem * @see see GxExpression
- rem */
- method public BBjVector getRows(BBjString phase! , BBjString filterExpression!)
- rows! = new BBjVector()
- returnedRows! = #getExecutor().execute("$wnd.gw_getRows('" + #getRootId() + "','" + phase! + "'," + (new Gson()).toJson(filterExpression!) + ")" , 0)
- if returnedRows! <> null() AND returnedRows! <> "[]" then
- parser! = new JsonParser()
- array! = parser!.parse(returnedRows!).getAsJsonArray()
- it! = array!.iterator()
- while (it!.hasNext())
- next! = it!.next().getAsJsonObject()
- rows!.add(#getClientJsonFactory().getRow(next!))
- wend
- FI
-
- methodret rows!
- methodend
- rem /**
- rem * Get the rows from grid in the given phase after applying the given
- rem * filter expression.
- rem *
- rem * Note: if you only need to get the whole rows from the grid and you don't care about
- rem * filtering and sorting Then retrieve them from ResultSet as this will be faster
- rem * especially in BUI
- rem *
- rem * @param BBjString phase! The rows phase
- rem * @param GxExpressionInterface filterExpression! A filter expression to execute before returning the rows.
- rem * The expression must return true or false for the given row
- rem *
- rem * @return BBjVector A vector of GxClientRowModel(s)
- rem *
- rem * @see #GRID_ROWS_PHASE_ALL()
- rem * @see #GRID_ROWS_PHASE_AFTER_FILTER()
- rem * @see #GRID_ROWS_PHASE_AFTER_FILTER_SORT()
- rem *
- rem * @see see GxExpression
- rem */
- method public BBjVector getRows(BBjString phase! , GxExpressionInterface filterExpression!)
- methodret #getRows(phase!, filterExpression!.toString())
- methodend
- rem /**
- rem * Get the rows from grid in the given phase after applying the given
- rem * filter expression.
- rem *
- rem * Note: if you only need to get the whole rows from the grid and you don't care about
- rem * filtering and sorting Then retrieve them from ResultSet as this will be faster
- rem * especially in BUI
- rem *
- rem * @param BBjString phase! The rows phase
- rem *
- rem * @return BBjVector A vector of GxClientRowModel(s)
- rem *
- rem * @see #GRID_ROWS_PHASE_ALL()
- rem * @see #GRID_ROWS_PHASE_AFTER_FILTER()
- rem * @see #GRID_ROWS_PHASE_AFTER_FILTER_SORT()
- rem */
- method public BBjVector getRows(BBjString phase!)
- methodret #getRows(phase!, "")
- methodend
- rem /**
- rem * Get the rows from grid after sorting and filtering
- rem *
- rem * @return BBjVector A vector of GxClientRowModel(s)
- rem */
- method public BBjVector getRows()
- methodret #getRows(#GRID_ROWS_PHASE_AFTER_FILTER_SORT())
- methodend
- rem /**
- rem * Expand all groups
- rem *
- rem *
#API
- rem */
- method public void expandAll()
- script$="$wnd.gw_expandAll('" + #getRootId() +"');"
- #getExecutor().execute(script$)
- methodend
- rem /**
- rem * collapse all groups
- rem *
- rem *
#API
- rem */
- method public void collapseAll()
- script$="$wnd.gw_collapseAll('" + #getRootId() +"');"
- #getExecutor().execute(script$)
- methodend
- rem /**
- rem * Ensures the row key is visible by vertically scrolling the grid
- rem *
- rem * Ensures the row index is visible by vertically scrolling the grid.
- rem * The valid values for positions are {'top', 'middle', 'bottom'}.
- rem * If top, middle or bottom, the grid will scroll the row to place the row at top, middle or bottom
- rem *
- rem *
#API
- rem *
- rem * @param BBjString key!: the row key
- rem * @param BBjString position!: the scrolling position
- rem *
- rem * @see GRID_ROWPOS_TOP()
- rem * @see GRID_ROWPOS_MIDDLE()
- rem * @see GRID_ROWPOS_BOTTOM()
- rem */
- method public void ensureIndexVisible(BBjString key! , BBjString position!)
- scriptKey! = "$wnd.gw_ensureIndexVisible"
- script$="$wnd.gw_ensureIndexVisible('" + #getRootId() + "','" + str(key!) + "','" + str(position!) +"');"
- #getExecutor().execute(scriptKey!,script$)
- methodend
- rem /**
- rem * Ensures the row index is visible by vertically scrolling the grid
- rem *
- rem * Ensures the row index is visible by vertically scrolling the grid.
- rem * The valid values for positions are {'top', 'middle', 'bottom'}.
- rem * If top, middle or bottom, the grid will scroll the row to place the row at top, middle or bottom
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber index!: the row index
- rem * @param BBjString position!: the scrolling position
- rem *
- rem * @see GRID_ROWPOS_TOP()
- rem * @see GRID_ROWPOS_MIDDLE()
- rem * @see GRID_ROWPOS_BOTTOM()
- rem */
- method public void ensureIndexVisible(BBjNumber index! , BBjString position!)
- #ensureIndexVisible(str(index!),position!)
- methodend
- rem /**
- rem * Ensures the row index is visible by vertically scrolling the grid
- rem *
- rem * Ensures the row index is visible by vertically scrolling the grid.
- rem * The valid values for positions are {'top', 'middle', 'bottom'}.
- rem * If top, middle or bottom, the grid will scroll the row to place the row at top, middle or bottom
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber index!: the row index
- rem * @param BBjString position!: the scrolling position
- rem *
- rem * @see GRID_ROWPOS_TOP()
- rem * @see GRID_ROWPOS_MIDDLE()
- rem * @see GRID_ROWPOS_BOTTOM()
- rem *
- rem * @deprecated since version 0.101.0, BBjGridExWidget.setVisibleRow(BBjNumber index! , BBjString position!) is deprecated / renamed. Use BBjGridExWidget.ensureIndexVisible(BBjNumber index! , BBjString position!) instead.
- rem */
- method public void setVisibleRow(BBjNumber index! , BBjString position!)
- GxLogger.warn("since version 0.101.0, BBjGridExWidget.setVisibleRow(BBjNumber index! , BBjString position!) is deprecated / renamed. Use BBjGridExWidget.ensureIndexVisible(BBjNumber index! , BBjString position!) instead.")
- #ensureIndexVisible(index!,position!)
- methodend
- rem /**
- rem * Ensures the column is visible, scrolling the table if needed.
- rem *
- rem *
#API
- rem *
- rem * @param BBJString columnid!: the column id
- rem */
- method public void ensureColumnVisible(BBjString columnId!)
- scriptKey! = "$wnd.gw_ensureColumnVisible"
- script$="$wnd.gw_ensureColumnVisible('" + #getRootId() + "','" + columnId! + "');"
- #getExecutor().execute(scriptKey!,script$)
- methodend
- rem /**
- rem * Sets the visibility of column(s)
- rem *
- rem * @param BBjString columns! A comma separated list of column ids to hide / show
- rem * @param BBjNumber hidden! True to hide , false to show
- rem */
- method public void setColumnVisible(BBjString columns! , BBjNumber hidden!)
- ids! = Arrays.asList(columns!.replaceAll(" ","").split(","))
- it! = ids!.iterator()
- while it!.hasNext()
- next! = it!.next()
-
- if(#hasColumn(next!))
- #getColumn(next!).setHidden(hidden!)
- fi
- wend
-
- script$="$wnd.gw_setColumnVisible('" + #getRootId() + "','" + columns! + "'," + str(hidden!.booleanValue()) +");"
- #getExecutor().execute(script$)
- methodend
- rem /**
- rem * Sets the visibility of a column
- rem *
- rem * @param GxColumn column! The column definition
- rem * @param BBjNumber hidden! True to hide , false to show
- rem */
- method public void setColumnVisible(GxColumn column! , BBjNumber hidden!)
- #setColumnVisible(column!.getField(), hidden!)
- methodend
- rem /**
- rem * Ensures the column is visible, scrolling the table if needed.
- rem *
- rem *
#API
- rem *
- rem * @param BBJString columnid!: the column id
- rem *
- rem * @deprecated since version 0.101.0, BBjGridExWidget.setVisibleColumn(BBjString columnId!) is deprecated / renamed. Use BBjGridExWidget.ensureColumnVisible(BBjString columnId!) instead.
- rem */
- method public void setVisibleColumn(BBjString columnId!)
- GxLogger.warn("since version 0.101.0, BBjGridExWidget.setVisibleColumn(BBjString columnId!) is deprecated / renamed. Use BBjGridExWidget.ensureColumnVisible(BBjString columnId!) instead.")
- #ensureColumnVisible(columnId!)
- methodend
- rem /**
- rem * Make the currently visible columns fit the screen.
- rem *
- rem * The columns will scale (growing or shrinking) to fit the available width.
- rem * If you don't want a particular column to be included in the auto resize,
- rem * then set the column setting SuppressSizeToFit=true.
- rem * This is helpful if, for example, you want the first column to remain fixed with, but all other columns
- rem * to fill the width of the table.
- rem *
- rem *
#API
- rem */
- method public void setFitToGrid()
- scriptKey! = "$wnd.gw_sizeColumnsToFit"
- #getExecutor().execute(scriptKey!,"$wnd.gw_sizeColumnsToFit('" + #getRootId() +"')")
- methodend
- rem /**
- rem * Gets the grid to size the columns to the specified with
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber width! the width to use to fit all columns in
- rem */
- method public void setFitToGrid(BBjNumber width!)
- scriptKey! = "$wnd.gw_sizeColumnsToFit"
- #getExecutor().execute(scriptKey!,"$wnd.gw_sizeColumnsToFit('" + #getRootId() +"','" + str(width!) + "')")
- methodend
- rem /**
- rem * looks at the rendered cells on the screen, and works out the width based on what it sees.
- rem * It cannot see the columns that are not rendered due to column virtualisation.
- rem * Thus it is not possible to autosize a column that is not visible on the screen.
- rem *
- rem * Column Virtualisation is the technique the grid uses to render large amounts of columns with
- rem * degrading performance by only rendering columns that are visible due to the horizontal scroll positions.
- rem * Eg the grid can have 1000 columns with only 10 rendered if the horizontal scroll is only showing 10 columns.
- rem * To get around this, you can turn off column virtualisation by setting grid options SuppressColumnVirtualisation=true.
- rem *
- rem *
#API
- rem *
- rem * @param HashSet columns! A set of columns to auto size
- rem * @param BBjNumber skipHeader! indicate that the header content (headerName) should not be considered when calculating
- rem * the width of the column.
- rem * You can also set this behavior to be the default by setting SkipHeaderOnAutoSize: true
- rem * in the grid options.
- rem */
- method public void autoSizeColumns(HashSet columns!, BBjNumber skipHeader!)
- columnsAsJson! = new Gson().toJson(columns!)
- #getExecutor().execute("$wnd.gw_autoSizeColumns('" + #getRootId() +"'," + str(skipHeader!.booleanValue()) + "," + str(columnsAsJson!) + ")")
- methodend
- rem /**
- rem * looks at the rendered cells on the screen, and works out the width based on what it sees.
- rem * It cannot see the columns that are not rendered due to column virtualisation.
- rem * Thus it is not possible to autosize a column that is not visible on the screen.
- rem *
- rem * Column Virtualisation is the technique the grid uses to render large amounts of columns with
- rem * degrading performance by only rendering columns that are visible due to the horizontal scroll positions.
- rem * Eg the grid can have 1000 columns with only 10 rendered if the horizontal scroll is only showing 10 columns.
- rem * To get around this, you can turn off column virtualisation by setting grid options SuppressColumnVirtualisation=true.
- rem *
- rem *
#API
- rem *
- rem * @param HashSet columns! A set of columns to auto size
- rem */
- method public void autoSizeColumns(HashSet columns!)
- #autoSizeColumns(columns! , 0)
- methodend
- rem /**
- rem * looks at the rendered cells on the screen, and works out the width based on what it sees.
- rem * It cannot see the columns that are not rendered due to column virtualisation.
- rem * Thus it is not possible to autosize a column that is not visible on the screen.
- rem *
- rem * Column Virtualisation is the technique the grid uses to render large amounts of columns with
- rem * degrading performance by only rendering columns that are visible due to the horizontal scroll positions.
- rem * Eg the grid can have 1000 columns with only 10 rendered if the horizontal scroll is only showing 10 columns.
- rem * To get around this, you can turn off column virtualisation by setting grid options SuppressColumnVirtualisation=true.
- rem *
- rem *
#API
- rem *
- rem * @param BBjString columns! A common separated list of columns to auto size
- rem * @param BBjNumber skipHeader! indicate that the header content (headerName) should not be considered when calculating
- rem * the width of the column.
- rem * You can also set this behavior to be the default by setting SkipHeaderOnAutoSize: true
- rem * in the grid options.
- rem */
- method public void autoSizeColumns(BBjString columns!, BBjNumber skipHeader!)
- columnsSet! = new HashSet()
- columnsSet!.addAll(Arrays.asList(columns!.replaceAll(" ","").split(",")))
- #autoSizeColumns(columnsSet!,skipHeader!)
- methodend
- rem /**
- rem * looks at the rendered cells on the screen, and works out the width based on what it sees.
- rem * It cannot see the columns that are not rendered due to column virtualisation.
- rem * Thus it is not possible to autosize a column that is not visible on the screen.
- rem *
- rem * Column Virtualisation is the technique the grid uses to render large amounts of columns with
- rem * degrading performance by only rendering columns that are visible due to the horizontal scroll positions.
- rem * Eg the grid can have 1000 columns with only 10 rendered if the horizontal scroll is only showing 10 columns.
- rem * To get around this, you can turn off column virtualisation by setting grid options SuppressColumnVirtualisation=true.
- rem *
- rem *
#API
- rem *
- rem * @param BBjString columns! A comma separated list of columns to auto size
- rem */
- method public void autoSizeColumns(BBjString columns!)
- #autoSizeColumns(columns! , 0)
- methodend
- rem /**
- rem * looks at the rendered cells on the screen, and works out the width based on what it sees.
- rem * It cannot see the columns that are not rendered due to column virtualisation.
- rem * Thus it is not possible to autosize a column that is not visible on the screen.
- rem *
- rem * Column Virtualisation is the technique the grid uses to render large amounts of columns with
- rem * degrading performance by only rendering columns that are visible due to the horizontal scroll positions.
- rem * Eg the grid can have 1000 columns with only 10 rendered if the horizontal scroll is only showing 10 columns.
- rem * To get around this, you can turn off column virtualisation by setting grid options SuppressColumnVirtualisation=true.
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber skipHeader! indicate that the header content (headerName) should not be considered when calculating
- rem * the width of the column.
- rem * You can also set this behavior to be the default by setting SkipHeaderOnAutoSize: true
- rem * in the grid options.
- rem */
- method public void autoSizeColumns(BBjNumber skipHeader!)
- #autoSizeColumns(new HashSet(),skipHeader!)
- methodend
- rem /**
- rem * looks at the rendered cells on the screen, and works out the width based on what it sees.
- rem * It cannot see the columns that are not rendered due to column virtualisation.
- rem * Thus it is not possible to autosize a column that is not visible on the screen.
- rem *
- rem * Column Virtualisation is the technique the grid uses to render large amounts of columns with
- rem * degrading performance by only rendering columns that are visible due to the horizontal scroll positions.
- rem * Eg the grid can have 1000 columns with only 10 rendered if the horizontal scroll is only showing 10 columns.
- rem * To get around this, you can turn off column virtualisation by setting grid options SuppressColumnVirtualisation=true.
- rem *
- rem *
#API
- rem */
- method public void autoSizeColumns()
- #autoSizeColumns(0)
- methodend
- rem /**
- rem *Gets the grid to remove a row from the DOM and recreate it again from scratch.
- rem */
- method public void redrawRows()
- #getExecutor().execute("$wnd.gw_redrawRows('" + #getRootId() +"')")
- methodend
- rem /**
- rem * Force the context object update
- rem */
- method public void updateContext()
- if(#IsReady!)
- #getExecutor().execute("$wnd.gw_updateContext('" + #getRootId() +"'," + #getClientContext().toString() + ")")
- FI
- methodend
- rem /**
- rem * Set and apply filter model for the given column
- rem *
- rem * @param BBjString column! the column id
- rem * @param GxClientFilterModel model! the model filter to use
- rem *
- rem *
#API
- rem *
#Configuration
- rem *
- rem * @return GxClientFilterModel the passed model
- rem */
- method public GxClientFilterModel setFilterModel(BBjString column!, GxClientFilterModel model!)
- model!.setWidget(#this!)
- model!.setColumn(column!)
- model!.update()
- methodret model!
- methodend
- rem /**
- rem * Set and apply a filter transaction
- rem *
- rem * The transaction is a `LinkedHashMap` of columns and their models.
- rem * This the fastest way to apply several filters on several columns.
- rem * When using this method The grid will delay executing the filters on the data
- rem * until all models are set and ready.
- rem *
- rem *
#API
- rem *
#Configuration
- rem *
- rem * @param LinkedHashMap transaction! a map of columns and their model
- rem */
- method public void executeFilterTransaction(LinkedHashMap transaction!)
- applyCode! = new HashSet()
- executeCode! = new HashSet()
- it! = transaction!.entrySet().iterator()
- while(it!.hasNext())
- next! = it!.next()
- column! = next!.getKey()
- model! = next!.getValue()
- model!.setWidget(#this!)
- model!.setColumn(column!)
- applyCode!.add(model!.apply(0))
- executeCode!.add(model!.execute(0))
- wend
-
- #getExecutor().execute(String.join("",applyCode!) + String.join("",executeCode!))
- methodend
- rem /**
- rem * Get The filter model for the given column
- rem *
- rem * This method will return a `GxClientFilterModel` for the given column
- rem * If column has already some filter values set through the UI , then the model will contain
- rem * these changes too.
- rem *
- rem * In case the grid is not ready (not renderer yet) then the method will just return
- rem * any empty filter model for the column.
- rem *
- rem *
#API
- rem *
#Configuration
- rem *
- rem * @param BBjString column! the column id to use for the constructed model
- rem *
- rem * @throws 256 in case the column has no filter component attached
- rem */
- method public GxClientFilterModel getFilterModel(BBjString column!)
- jsonModel! = null()
- rem we try to get the model from the UI first
- if(#getIsReady() = BBjAPI.TRUE)
- code! = String.format("JSON.stringify($wnd.gw_getGrid('%s').options.api.getFilterInstance('%s').getModel());" , #getRootId(), column!)
- jsonModel! = #getExecutor().execute(code! , 0)
- FI
-
- if(jsonModel! <> null() AND jsonModel! <> "null")
- methodret #getClientJsonFactory().getFilter(jsonModel!,column!)
- else
- model! = null()
- rem we try to detect the filter type and create its model
- if (#getColumn(column!).getFilter() <> null())
- filterName! = #getColumn(column!).getFilter().getFilterName()
- SWITCH (filterName!)
- CASE GxFilterNumber.getFilterName()
- model! = new GxClientFilterNumberModel()
- break
- CASE GxFilterBasicTimestamp.getFilterName()
- model! = new GxClientFilterDateTimeModel()
- break
- CASE GxFilterBasicBoolean.getFilterName()
- model! = new GxClientFilterBooleanModel()
- break
- CASE GxFilterText.getFilterName()
- model! = new GxClientFilterTextModel()
- break
- CASE GxFilterSetFilter.getFilterName()
- model! = new GxClientFilterSetFilterModel()
- break
- SWEND
- FI
-
- if(model! = null())
- throw "Failed to create column filter's model. The column has no filter component attached" , 256
- FI
-
- model!.setWidget(#this!)
- model!.setColumn(column!)
- methodret model!
- FI
- methodend
- rem /**
- rem * Get The combined filter model for the given column
- rem *
- rem * This method will return a `GxClientFilterCombinedModel` for the given column
- rem * If the column has already some filter values set through the UI , then the model will contain
- rem * these changes too.
- rem *
- rem * In case the grid is not ready (not renderer yet) then the method will just return
- rem * any empty combined filter model for the column.
- rem *
- rem *
#API
- rem *
#Configuration
- rem *
- rem * @param BBjString column! the column id to use for the constructed model
- rem *
- rem * @throws 256 in case the column filter does not support the combined model
- rem */
- method public GxClientFilterCombinedModel getFilterAsCombinedModel(BBjString column!)
- model! = #getFilterModel(column!)
- rem first check if the model is already a combined model
- isAlreadyCombined! = 0
- model! = cast(GxClientFilterCombinedModel,model!,err=*next); isAlreadyCombined! = 1
-
- if(isAlreadyCombined! = 0 AND model!.supportsCombinedModel() = 0)
- throw "The column's filter component does not support combined models" , 256
- FI
-
- combinedModel! = iff(isAlreadyCombined!,model! ,new GxClientFilterCombinedModel() )
- combinedModel!.setWidget(#this!)
- combinedModel!.setColumn(column!)
-
- if(!isAlreadyCombined!)
- combinedModel!.setFirstCondition(model!)
- FI
-
- methodret combinedModel!
- methodend
- rem /**
- rem * Clear all active filters on columns
- rem *
- rem *
#API
- rem */
- method public void clearFilters()
- code! = String.format(";var api = $wnd.gw_getGrid('%s').options.api;" , #getRootId())
- code! = code! + "api.setFilterModel(null);api.onFilterChanged(null);"
- wrap! = ";(function(){" + code! + "})();"
- #getExecutor().execute(wrap! , 0)
- methodend
- rem /**
- rem * setSize - set the size of the control
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber w! - width
- rem * @param BBjNumber h! - height
- rem */
- method public void setSize(BBjNumber w!, BBjNumber h!)
- rem if setSize is called before the page is ready, delay its execution
- if #IsReady! then
- #super!.setSize(w!,h!)
- else
- rem cheat with the superclass so getWidth / getHeight already return the later size
- #super!.setW(w!)
- #super!.setH(h!)
- #newW! = w!
- #newH! = h!
- FI
- methodend
- rem /**
- rem * Set all rows height
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber height! - the new row height
- rem */
- method public void setRowHeight(BBjNumber height!)
- #getOptions().setRowHeight(height!)
- scriptKey! = "$wnd.gw_setRowsHeight"
- #getExecutor().execute(scriptKey!,"$wnd.gw_setRowsHeight('" + #getRootId() + "'," + str(height!) + ")")
- methodend
- rem /**
- rem * Set the given row height
- rem *
- rem *
#API
- rem *
- rem * @param BBjString key! - the row key
- rem * @param BBjNumber height! - the new row height
- rem */
- method public void setRowHeight(BBjString key!, BBjNumber height!)
- scriptKey! = "$wnd.gw_setRowsHeight" + key!
- #getExecutor().execute(scriptKey!,"$wnd.gw_setRowHeight('" + #getRootId() + "','" + str(key!) + "'," + str(height!) + ")")
- methodend
- rem /**
- rem * Set the given row height
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber index! - the row index
- rem * @param BBjNumber height! - the new row height
- rem */
- method public void setRowHeight(BBjNumber index!, BBjNumber height!)
- #setRowHeight(str(index!) , height!)
- methodend
- rem /**
- rem * Reset The row heights.
- rem *
- rem *
#API
- rem *
- rem * The rows height is calculated once when the data is first given to the grid.
- rem * If the data changes, or the width of a column changes, then you may require the grid to calculate
- rem * the height again by calling this method
- rem */
- method public void resetRowHeights()
- #getExecutor().execute("$wnd.gw_resetRowHeights('" + #getRootId() + "')",0)
- methodend
- rem /**
- rem * Set a sorting for one or more columns
- rem *
- rem *
#API
- rem *
- rem * @param GxClientSortModel model! the sorting model
- rem */
- method public void setSortModel(GxClientSortModel model!)
- #getExecutor().execute("$wnd.gw_setSortModel('" + #getRootId() + "','" + str(model!.getAsJsonArray()) + "')")
- methodend
- rem /**
- rem * Sort the given column with the given direction
- rem *
- rem *
#API
- rem *
- rem * @param BBjString column! The column id
- rem * @param BBjString direction! The sort direction
- rem *
- rem * @see setSortModel
- rem */
- method public void sortColumn(BBjString column! , BBjString direction!)
- model! = new GxClientSortModel()
- model!.add(column! , direction!)
- #setSortModel(model!)
- methodend
- rem /**
- rem * Enable / disable pivot mode
- rem *
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @param BBjNumber mode! when true, the pivot mode will be enabled, disabled otherwise
- rem */
- method public void setPivotMode(BBjNumber mode!)
- #getOptions().setPivotMode(mode!)
-
- if(#IsReady!) then
- scriptKey! = "$wnd.gw_setPivotMode"
- #getExecutor().execute(scriptKey!,"$wnd.gw_setPivotMode('" + #getRootId() + "'," + str(mode!) + ")")
- FI
- methodend
- rem /**
- rem * Check if pivot mode is enabled or disabled
- rem *
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @return BBjNumber 1 when pivot mode is enabled, 0 otherwise
- rem */
- method public BBjNumber getPivotMode()
- if(#IsReady!) then
- mode! = #getExecutor().execute("$wnd.gw_getPivotMode('" + #getRootId() + "'," + str(mode!) + ")" , 0)
- #getOptions().setPivotMode(num(mode!))
- FI
-
- methodret #getOptions().getPivotMode()
- methodend
- rem /**
- rem * Perform throw columns search
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber filter filter as number
- rem */
- method public void setQuickFilter(BBjString filter!)
- scriptKey! = "$wnd.gw_setQuickFilter"
- #getExecutor().execute(scriptKey!,"$wnd.gw_setQuickFilter('" + #getRootId() + "','" + filter! +"')")
- methodend
- rem /**
- rem * Perform throw columns search
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber filter! filter as a number
- rem */
- method public void setQuickFilter(BBjNumber filter!)
- #setQuickFilter(str(filter!))
- methodend
- rem /**
- rem * Start Next Cell Editing
- rem *
- rem *
#API
- rem */
- method public void moveToNextCell()
- #getExecutor().execute("$wnd.gw_editNextCell('"+ #getRootId() + "')")
- methodend
- rem /**
- rem * Move to previous cell
- rem *
- rem *
#API
- rem */
- method public void moveToPreviousCell()
- #getExecutor().execute("$wnd.gw_editPreviousCell('" + #getRootId() + "')")
- methodend
- rem /**
- rem * Start Cell Editing at the given row and column
- rem *
- rem *
#API
- rem *
- rem * @param BBjString key! The row key
- rem * @param BBjString column! The column ID
- rem * @param BBjNumber keyPress! The key code to pass to the editor when the editor supports it
- rem * @param BBjString charPress! The key char to pass to the editor when the editor supports it
- rem * @param BBjString floating! The row floating (top , bottom or none)
- rem *
- rem * @see BBjGridExWidget.GRID_FLOATING_NONE()
- rem * @see BBjGridExWidget.GRID_FLOATING_TOP()
- rem * @see BBjGridExWidget.GRID_FLOATING_BOTTOM()
- rem */
- method public void setStartCellEditing(BBjString key!, BBjString column!, BBjNumber keyPress!, BBjString charPress!, BBjString floating!)
- params! = String.format("'%s','%s','%s',%s,'%s','%s'",#getRootId(), key!, column!, str(keyPress!), charPress!, floating!)
- #getExecutor().execute("$wnd.gw_startEditingCell(" + params! + ")")
- methodend
- rem /**
- rem * Start Cell Editing at the given row and column
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber index! The row index
- rem * @param BBjString column! The column ID
- rem * @param BBjNumber keyPress! The key code to pass to the editor when the editor supports it
- rem * @param BBjString charPress! The key char to pass to the editor when the editor supports it
- rem * @param BBjString floating! The row floating (top , bottom or none)
- rem *
- rem * @see BBjGridExWidget.GRID_FLOATING_NONE()
- rem * @see BBjGridExWidget.GRID_FLOATING_TOP()
- rem * @see BBjGridExWidget.GRID_FLOATING_BOTTOM()
- rem */
- method public void setStartCellEditing(BBjNumber index!, BBjString column!, BBjNumber keyPress!, BBjString charPress!, BBjString floating!)
- #setStartCellEditing(str(index!), column!, keyPress!, charPress!, floating!)
- methodend
- rem ===========================
- rem /**
- rem * Start Cell Editing at the given row and column
- rem *
- rem *
#API
- rem *
- rem * @param BBjString key! The row key
- rem * @param BBjString column! The column ID
- rem */
- method public void setStartCellEditing(BBjString key!, BBjString column!)
- #setStartCellEditing(key!, column!, -100, "", #GRID_FLOATING_NONE())
- methodend
- rem /**
- rem * Start Cell Editing at the given row and column
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber index! The row index
- rem * @param BBjString column! The column ID
- rem */
- method public void setStartCellEditing(BBjNumber index!, BBjString column!)
- #setStartCellEditing(str(index!), column!)
- methodend
- rem /**
- rem * Start Cell Editing at the given row and column
- rem *
- rem *
#API
- rem *
- rem * @param BBjString key! The row key
- rem * @param BBjString column! The column ID
- rem * @param BBjString charPress! The key char to pass to the editor when the editor supports it
- rem */
- method public void setStartCellEditing(BBjString key!, BBjString column!, BBjString charPress!)
- #setStartCellEditing(key!, column!, -100, charPress!, #GRID_FLOATING_NONE())
- methodend
- rem /**
- rem * Start Cell Editing at the given row and column
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber index! The row index
- rem * @param BBjString column! The column ID
- rem * @param BBjString charPress! The key char to pass to the editor when the editor supports it
- rem */
- method public void setStartCellEditing(BBjNumber index!, BBjString column!, BBjString charPress!)
- #setStartCellEditing(str(index!), column!, charPress!)
- methodend
- rem /**
- rem * Start Cell Editing at the given row and column
- rem *
- rem *
#API
- rem *
- rem * @param BBjString key! The row key
- rem * @param BBjString column! The column ID
- rem * @param BBjNumber keyPress! The key code to pass to the editor when the editor supports it
- rem */
- method public void setStartCellEditing(BBjString key!, BBjString column!, BBjNumber keyPress!)
- #setStartCellEditing(key!, column!, keyPress!, "", #GRID_FLOATING_NONE())
- methodend
- rem /**
- rem * Start Cell Editing at the given row and column
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber index! The row index
- rem * @param BBjString column! The column ID
- rem * @param BBjNumber keyPress! The key code to pass to the editor when the editor supports it
- rem */
- method public void setStartCellEditing(BBjNumber index!, BBjString column!, BBjNumber keyPress!)
- #setStartCellEditing(str(index!), column!, keyPress!)
- methodend
- rem /**
- rem * Navigates the grid focus to the next cell, as if tabbing.
- rem *
- rem *
#API
- rem *
- rem * @deprecated since version 0.101.0, BBjGridExWidget.startNextCellEditing() is deprecated / renamed. Use BBjGridExWidget.tabToNextCell() instead.
- rem */
- method public void startNextCellEditing()
- GxLogger.warn("since version 0.101.0, BBjGridExWidget.startNextCellEditing() is deprecated / renamed. Use BBjGridExWidget.tabToNextCell() instead.")
- #tabToNextCell()
- methodend
- rem /**
- rem * Navigates the grid focus to the previous cell, as if shift-tabbing.
- rem *
- rem *
#API
- rem *
- rem * @deprecated since version 0.101.0, BBjGridExWidget.startPreviousCellEditing() is deprecated / renamed. Use BBjGridExWidget.tabToPreviousCell() instead.
- rem */
- method public void startPreviousCellEditing()
- GxLogger.warn("since version 0.101.0, BBjGridExWidget.startPreviousCellEditing() is deprecated / renamed. Use BBjGridExWidget.tabToPreviousCell() instead.")
- #tabToPreviousCell()
- methodend
- rem /**
- rem * Stop editing and accepts changes
- rem *
- rem *
#API
- rem */
- method public void stopEditing()
- #getExecutor().execute("$wnd.gw_stopEditing('" + #getRootId() + "',0)")
- methodend
- rem /**
- rem * Stop Editing
- rem *
- rem *
#API
- rem *
- rem * @param BBjNumber cancel!: 1 = discard changes, 0 = accept changes
- rem */
- method public void stopEditing(BBjNumber cancel!)
- #getExecutor().execute("$wnd.gw_stopEditing('"+ #getRootId() + "'," + STR(cancel!)+ ")")
- methodend
- rem /**
- rem * If true, then row group, pivot and value aggregation will be read only from the Ui.
- rem * The grid will display what values are used for each, but will not allow the use to change the selection
- rem *
- rem *
#Enterprise
- rem *
#Configuration
- rem *
#API
- rem *
- rem * @param BBjNumber readonly! when true disable, enable otherwise
- rem */
- method public void setFunctionsReadOnly(BBjNumber readonly!)
- #getOptions().setFunctionsReadOnly(readonly!)
- scriptKey! = "$wnd.gw_setFunctionsReadOnly"
- #getExecutor().execute(scriptKey!,"$wnd.gw_setFunctionsReadOnly('" + #getRootId() + "'," + str(readonly!) +")")
- methodend
- rem /**
- rem * Sync the client row data every time a new GxClientRowModel
- rem * is composed by the grid.
- rem *
- rem * Use this method if the row's data in the client is different that the row's data in
- rem * the ResultSet
- rem *
- rem * @param BBjNumber include! when true the ClientRow field will always be filled in GxClientRowModel
- rem * otherwise it will always be null().
- rem *
- rem *
#Configuration
- rem *
#API
- rem */
- method public void includeClientRowDataInRowModels(BBjNumber include!)
- #getClientContext().addProperty("includeClientRowData",include!.booleanValue())
- #updateContext()
- methodend
- rem /**
- rem * The method will return a vector of the selected ranges including columns and rows
- rem *
- rem *
#API
- rem *
- rem * @return BBjVector
- rem */
- method public BBjVector getRangeSelections()
- rem an array to save the parsed range selections
- rangeSelectionVector! = new BBjVector()
- rem get the range selections from the client
- rem the client will return an array of objects where each object is a range
- rangeSelections! = #getExecutor().execute("$wnd.gw_getRangeSelections('" + #getRootId() + "')",0)
-
- if (rangeSelections! = "[]") then
- goto getSelectionRangeErr
- FI
- rem iterate throw the ranges array and parse the range objects
- parser! = new JsonParser()
- ranges! = parser!.parse(rangeSelections!).getAsJsonArray()
- rangesIterator! = ranges!.iterator()
- while (rangesIterator!.hasNext())
- model! = #getClientJsonFactory().getRangeSelection(rangesIterator!.next().getAsJsonObject())
- rangeSelectionVector!.addItem(model!)
- wend
-
- getSelectionRangeErr:
- methodret rangeSelectionVector!
- methodend
- rem /**
- rem * Add new range selection
- rem *
- rem *
#API
- rem *
- rem * @param GxClientAddRangeSelectionModel model! the add selection model
- rem *
- rem * @return GxClientAddRangeSelectionModel
- rem */
- method public GxClientAddRangeSelectionModel addRangeSelection(GxClientAddRangeSelectionModel model!)
- #getExecutor().execute("$wnd.gw_addCellRange('" + #getRootId() + "'," + model!.getAsJsonObject().toString() + ")")
- methodret model!
- methodend
- rem /**
- rem * Add new range selection
- rem *
- rem *
#API
- rem *
- rem * @param BBjString columns! columns as comma separated string (ex: CDNUMBER, COST)
- rem * @param BBjString start! start row id or index
- rem * @param BBjString end! end row id or index
- rem *
- rem * @return GxClientAddRangeSelectionModel
- rem */
- method public GxClientAddRangeSelectionModel addRangeSelection(BBjString columns! , BBjString start! , BBjString end!)
- model! = new GxClientAddRangeSelectionModel()
- model!.setColumns(columns!)
- model!.setStart(start!)
- model!.setEnd(end!)
- methodret #addRangeSelection(model!)
- methodend
- rem /**
- rem * Add new range selection
- rem *
- rem *
#API
- rem *
- rem * @param BBjString columns! columns as comma separated string (ex: CDNUMBER, COST)
- rem * @param BBjNumber start! start row id or index
- rem * @param BBjNumber end! end row id or index
- rem *
- rem * @return GxClientAddRangeSelectionModel
- rem */
- method public GxClientAddRangeSelectionModel addRangeSelection(BBjString columns! , BBjNumber start! , BBjNumber end!)
- methodret #addRangeSelection(columns! , str(start!),str(end!))
- methodend
- rem /**
- rem * Add new range selection
- rem *
- rem *
#API
- rem *
- rem * @param BBjString columns! columns as comma separated string (ex: CDNUMBER, COST)
- rem *
- rem * @return GxClientAddRangeSelectionModel
- rem */
- method public GxClientAddRangeSelectionModel addRangeSelection(BBjString columns!)
- methodret #addRangeSelection(columns!,null() , null())
- methodend
- rem /**
- rem * Clears the selected range.
- rem *
- rem *
#API
- rem */
- method public void clearRangeSelection()
- #getExecutor().execute("$wnd.gw_clearRangeSelection('" + #getRootId() + "')",0)
- methodend
- rem /**
- rem * Clear already created charts.
- rem * Note that this method does not clear user created charts
- rem *
- rem *
#API
- rem *
- rem * @param GxClientAddRangeChartModel model! the add range model
- rem * @return BBjString A unique id for the created chart
- rem */
- method public BBjString addRangeChart(GxClientAddRangeChartModel model!)
- uuid! = #getExecutor().execute("$wnd.gw_addChartRange('" + #getRootId() + "'," + model!.getAsJsonObject().toString() + ")" , 0)
- methodret str(uuid!)
- methodend
- rem /**
- rem * Clear already created chart by its id
- rem *
- rem *
#API
- rem * Note that this method does not clear user created charts
- rem *
- rem * @param BBjString id! the chart's id to destroy
- rem */
- method public void clearChart(BBjString id!)
- rem /**
- rem * Even Though the `gw_destroyChart` function does not return any value
- rem * we don't debounce the call because the developer might call
- rem * `addRangeChart` before calling this method. and `addRangeChart` is not debounced call
- rem * which will lead the chart to be created and then destroy directly
- rem */
- #getExecutor().execute("$wnd.gw_destroyChart('" + #getRootId() + "','" + str(id!) + "')",0)
- methodend
- rem /**
- rem * Clear already created charts.
- rem * Note that this method does not clear user created charts
- rem *
- rem *
#API
- rem */
- method public void clearChart()
- rem /**
- rem * Even Though the `gw_destroyChart` function does not return any value
- rem * we don't debounce the call because the developer might call
- rem * `addRangeChart` before calling this method. and `addRangeChart` is not debounced call
- rem * which will lead the chart to be created and then destroy directly
- rem */
- #getExecutor().execute("$wnd.gw_destroyChart('" + #getRootId() + "')",0)
- methodend
- rem /**
- rem * Show loading overlay
- rem *
- rem *
#API
- rem */
- method public void showLoadingOverlay()
- #getExecutor().execute("$wnd.gw_showLoadingOverlay('" + #getRootId() + "')", 0)
- methodend
- rem /**
- rem * Show 'no rows' overlay
- rem *
- rem *
#API
- rem */
- method public void showNoRowsOverlay()
- #getExecutor().execute("$wnd.gw_showNoRowsOverlay('" + #getRootId() + "')", 0)
- methodend
- rem /**
- rem * Clear all overlays
- rem *
- rem *
#API
- rem */
- method public void hideOverlay()
- #getExecutor().execute("$wnd.gw_hideOverlay('" + #getRootId() + "')", 0)
- methodend
- rem /**
- rem * Destroy the grid
- rem */
- method public void destroy()
- #super!.destroy()
- #IsReady! = BBjAPI.FALSE
- methodend
- rem /**
- rem * Fires an event
- rem *
- rem * @param Int type! The event's type
- rem * @param Object payload! The event's payload
- rem *
- rem * @Override
- rem */
- method protected void fireEvent(int type!, Object payload!)
- el! = new JsonPrimitive(type!)
-
- if(#getInterests().contains(el!)) then
- #super!.fireEvent(type!,payload!)
- FI
- methodend
- rem /**
- rem * Send the current interests to the client
- rem */
- method protected void updateClientWithInterests()
- #getClientContext().add("interests",#getInterests())
- #updateContext()
- methodend
- rem /**
- rem * The method will add the default chart toolbar items
- rem */
- method protected void fillChartToolbarItems()
- #getChartToolbarItems().add(#CHART_TOOLBAR_SETTINGS())
- #getChartToolbarItems().add(#CHART_TOOLBAR_DATA())
- #getChartToolbarItems().add(#CHART_TOOLBAR_FORMAT())
- #getChartToolbarItems().add(#CHART_TOOLBAR_DOWNLOAD())
- methodend
- rem /**
- rem * Get the grid template
- rem *
- rem * @return BBjString parsed html template
- rem */
- method protected BBjString getTemplate()
- html$ = #Template$
-
- if(len(html$) = 0) then
- ch=unt
- open (ch)"BBjGridExWidget/client/index.html"
- read record (ch,siz=5512000)html$
- close (ch)
- FI
-
- html! = html$
- html! = html!.replaceAll("__id__" , #getRootId())
- html! = html!.replaceAll("__lang__", #getLanguageManager().getLanguage())
- html! = html!.replaceAll("__THEME__", "ag-theme-" + #getOptions().getTheme())
- methodret html!
- methodend
-
- method protected void handleStateChangedEvent(BBjString detail$, BBjNumber type!)
- event! = #getState()
- #fireEvent(type!, event!)
- methodend
- rem /**
- rem * Handle Range Selections Event
- rem *
- rem * @see GxClientEventsRangeSelection
- rem */
- method private void onRangeSelectionChange(BBjString detail$)
- event! = new GxClientEventsRangeSelection()
- #fireEvent(#ON_GRID_RANGE_SELECTION_CHANGED(),event!)
- methodend
- rem /**
- rem * On rows selections event
- rem *
- rem * Parse the json details coming from the client and fires new GxSelectRowEvent
- rem *
- rem * @param BBjString detail$ The event detail as Json
- rem * @param BBjNumber type! The event type
- rem *
- rem * @see GxSelectRowEvent
- rem */
- method protected void onSelectRowChange(BBjString detail$, BBjNumber type!)
- declare GxClientEventsRowSelection event!
- declare JsonParser parser!
-
- event! = new GxClientEventsRowSelection()
- event!.setSelectedRows(#getSelectedRows())
- rem report keypress for click events only
- if(type! = #ON_GRID_ROW_CLICK() OR type! = #ON_GRID_DOUBLE_CLICK())
- parser! = new JsonParser()
- detailsAsJson! = parser!.parse(detail$).getAsJsonObject()
- keypress! = null()
-
- if(detailsAsJson!.has("k") AND detailsAsJson!.get("k").isJsonNull() = BBjAPI.FALSE) then
- keypress! = #getClientJsonFactory().getKeypress(detailsAsJson!.get("k").getAsJsonObject())
- fi
-
- event!.setKey(keypress!)
- fi
-
- #fireEvent(type!,event!)
- methodend
- rem /**
- rem * On context menu event
- rem *
- rem * @param BBjString detail$ The event response
- rem */
- method protected void onContextmenuEvent(BBjString detail$)
- declare JsonParser parser!
-
- parser! = new JsonParser()
- parsedCell! = parser!.parse(detail$).getAsJsonObject()
- cell! = #getClientJsonFactory().getCell(parsedCell!)
- event! = new GxClientEventsContextMenu()
- event!.setCell(cell!)
- #fireEvent(parsedCell!.get("i").getAsInt(),event!)
- methodend
- rem /**
- rem * On cell Event. handles cell clicking and editing events
- rem *
- rem * @param BBjString detail$ The event detail as Json
- rem * @param BBjNumber type! The event type
- rem *
- rem * @see ON_GRID_CELL_VALUE_CHANGED()
- rem * @see ON_GRID_CELL_DOUBLE_CLICK()
- rem * @see ON_GRID_CELL_CLICK()
- rem */
- method protected void onCellEvent(BBjString detail$ , BBjNumber type!)
- declare JsonParser parser!
-
- parser! = new JsonParser()
- parsedCell! = parser!.parse(detail$).getAsJsonObject()
- cell! = #getClientJsonFactory().getCell(parsedCell!)
- event! = new GxClientEventsCell()
- event!.setCell(cell!)
- event!.setOldValue(parsedCell!.get("o").getAsString(), err=*next)
-
- if(type! = #ON_GRID_CELL_CLICK() OR type! = #ON_GRID_CELL_DOUBLE_CLICK())
- if(parsedCell!.has("k") AND parsedCell!.get("k").isJsonNull() = BBjAPI.FALSE) then
- keypress! = #getClientJsonFactory().getKeypress(parsedCell!.get("k").getAsJsonObject())
+ methodend
+ rem /**
+ rem * Get The combined filter model for the given column
+ rem *
+ rem * This method will return a `GxClientFilterCombinedModel` for the given column
+ rem * If the column has already some filter values set through the UI , then the model will contain
+ rem * these changes too.
+ rem *
+ rem * In case the grid is not ready (not renderer yet) then the method will just return
+ rem * any empty combined filter model for the column.
+ rem *
+ rem *
#API
+ rem *
#Configuration
+ rem *
+ rem * @param BBjString column! the column id to use for the constructed model
+ rem *
+ rem * @throws 256 in case the column filter does not support the combined model
+ rem */
+ method public GxClientFilterCombinedModel getFilterAsCombinedModel(BBjString column!)
+ model! = #getFilterModel(column!)
+ rem first check if the model is already a combined model
+ isAlreadyCombined! = 0
+ model! = cast(GxClientFilterCombinedModel,model!,err=*next); isAlreadyCombined! = 1
+
+ if(isAlreadyCombined! = 0 AND model!.supportsCombinedModel() = 0)
+ throw "The column's filter component does not support combined models" , 256
+ FI
+
+ combinedModel! = iff(isAlreadyCombined!,model! ,new GxClientFilterCombinedModel() )
+ combinedModel!.setWidget(#this!)
+ combinedModel!.setColumn(column!)
+
+ if(!isAlreadyCombined!)
+ combinedModel!.setFirstCondition(model!)
+ FI
+
+ methodret combinedModel!
+ methodend
+ rem /**
+ rem * Clear all active filters on columns
+ rem *
+ rem *
#API
+ rem */
+ method public void clearFilters()
+ code! = String.format(";var api = $wnd.gw_getGrid('%s').options.api;" , #getRootId())
+ code! = code! + "api.setFilterModel(null);api.onFilterChanged(null);"
+ wrap! = ";(function(){" + code! + "})();"
+ #getExecutor().execute(wrap! , 0)
+ methodend
+ rem /**
+ rem * setSize - set the size of the control
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber w! - width
+ rem * @param BBjNumber h! - height
+ rem */
+ method public void setSize(BBjNumber w!, BBjNumber h!)
+ rem if setSize is called before the page is ready, delay its execution
+ if #IsReady! then
+ #super!.setSize(w!,h!)
+ else
+ rem cheat with the superclass so getWidth / getHeight already return the later size
+ #super!.setW(w!)
+ #super!.setH(h!)
+ #newW! = w!
+ #newH! = h!
+ FI
+ methodend
+ rem /**
+ rem * Set all rows height
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber height! - the new row height
+ rem */
+ method public void setRowHeight(BBjNumber height!)
+ #getOptions().setRowHeight(height!)
+ scriptKey! = "$wnd.gw_setRowsHeight"
+ #getExecutor().execute(scriptKey!,"$wnd.gw_setRowsHeight('" + #getRootId() + "'," + str(height!) + ")")
+ methodend
+ rem /**
+ rem * Set the given row height
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString key! - the row key
+ rem * @param BBjNumber height! - the new row height
+ rem */
+ method public void setRowHeight(BBjString key!, BBjNumber height!)
+ scriptKey! = "$wnd.gw_setRowsHeight" + key!
+ #getExecutor().execute(scriptKey!,"$wnd.gw_setRowHeight('" + #getRootId() + "','" + str(key!) + "'," + str(height!) + ")")
+ methodend
+ rem /**
+ rem * Set the given row height
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber index! - the row index
+ rem * @param BBjNumber height! - the new row height
+ rem */
+ method public void setRowHeight(BBjNumber index!, BBjNumber height!)
+ #setRowHeight(str(index!) , height!)
+ methodend
+ rem /**
+ rem * Reset The row heights.
+ rem *
+ rem *
#API
+ rem *
+ rem * The rows height is calculated once when the data is first given to the grid.
+ rem * If the data changes, or the width of a column changes, then you may require the grid to calculate
+ rem * the height again by calling this method
+ rem */
+ method public void resetRowHeights()
+ #getExecutor().execute("$wnd.gw_resetRowHeights('" + #getRootId() + "')",0)
+ methodend
+ rem /**
+ rem * Set a sorting for one or more columns
+ rem *
+ rem *
#API
+ rem *
+ rem * @param GxClientSortModel model! the sorting model
+ rem */
+ method public void setSortModel(GxClientSortModel model!)
+ #getExecutor().execute("$wnd.gw_setSortModel('" + #getRootId() + "','" + str(model!.getAsJsonArray()) + "')")
+ methodend
+ rem /**
+ rem * Sort the given column with the given direction
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString column! The column id
+ rem * @param BBjString direction! The sort direction
+ rem *
+ rem * @see setSortModel
+ rem */
+ method public void sortColumn(BBjString column! , BBjString direction!)
+ model! = new GxClientSortModel()
+ model!.add(column! , direction!)
+ #setSortModel(model!)
+ methodend
+ rem /**
+ rem * Enable / disable pivot mode
+ rem *
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @param BBjNumber mode! when true, the pivot mode will be enabled, disabled otherwise
+ rem */
+ method public void setPivotMode(BBjNumber mode!)
+ #getOptions().setPivotMode(mode!)
+
+ if(#IsReady!) then
+ scriptKey! = "$wnd.gw_setPivotMode"
+ #getExecutor().execute(scriptKey!,"$wnd.gw_setPivotMode('" + #getRootId() + "'," + str(mode!) + ")")
+ FI
+ methodend
+ rem /**
+ rem * Check if pivot mode is enabled or disabled
+ rem *
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @return BBjNumber 1 when pivot mode is enabled, 0 otherwise
+ rem */
+ method public BBjNumber getPivotMode()
+ if(#IsReady!) then
+ mode! = #getExecutor().execute("$wnd.gw_getPivotMode('" + #getRootId() + "'," + str(mode!) + ")" , 0)
+ #getOptions().setPivotMode(num(mode!))
+ FI
+
+ methodret #getOptions().getPivotMode()
+ methodend
+ rem /**
+ rem * Perform throw columns search
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber filter filter as number
+ rem */
+ method public void setQuickFilter(BBjString filter!)
+ scriptKey! = "$wnd.gw_setQuickFilter"
+ #getExecutor().execute(scriptKey!,"$wnd.gw_setQuickFilter('" + #getRootId() + "','" + filter! +"')")
+ methodend
+ rem /**
+ rem * Perform throw columns search
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber filter! filter as a number
+ rem */
+ method public void setQuickFilter(BBjNumber filter!)
+ #setQuickFilter(str(filter!))
+ methodend
+ rem /**
+ rem * Start Next Cell Editing
+ rem *
+ rem *
#API
+ rem */
+ method public void moveToNextCell()
+ #getExecutor().execute("$wnd.gw_editNextCell('"+ #getRootId() + "')")
+ methodend
+ rem /**
+ rem * Move to previous cell
+ rem *
+ rem *
#API
+ rem */
+ method public void moveToPreviousCell()
+ #getExecutor().execute("$wnd.gw_editPreviousCell('" + #getRootId() + "')")
+ methodend
+ rem /**
+ rem * Start Cell Editing at the given row and column
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString key! The row key
+ rem * @param BBjString column! The column ID
+ rem * @param BBjNumber keyPress! The key code to pass to the editor when the editor supports it
+ rem * @param BBjString charPress! The key char to pass to the editor when the editor supports it
+ rem * @param BBjString floating! The row floating (top , bottom or none)
+ rem *
+ rem * @see BBjGridExWidget.GRID_FLOATING_NONE()
+ rem * @see BBjGridExWidget.GRID_FLOATING_TOP()
+ rem * @see BBjGridExWidget.GRID_FLOATING_BOTTOM()
+ rem */
+ method public void setStartCellEditing(BBjString key!, BBjString column!, BBjNumber keyPress!, BBjString charPress!, BBjString floating!)
+ params! = String.format("'%s','%s','%s',%s,'%s','%s'",#getRootId(), key!, column!, str(keyPress!), charPress!, floating!)
+ #getExecutor().execute("$wnd.gw_startEditingCell(" + params! + ")")
+ methodend
+ rem /**
+ rem * Start Cell Editing at the given row and column
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber index! The row index
+ rem * @param BBjString column! The column ID
+ rem * @param BBjNumber keyPress! The key code to pass to the editor when the editor supports it
+ rem * @param BBjString charPress! The key char to pass to the editor when the editor supports it
+ rem * @param BBjString floating! The row floating (top , bottom or none)
+ rem *
+ rem * @see BBjGridExWidget.GRID_FLOATING_NONE()
+ rem * @see BBjGridExWidget.GRID_FLOATING_TOP()
+ rem * @see BBjGridExWidget.GRID_FLOATING_BOTTOM()
+ rem */
+ method public void setStartCellEditing(BBjNumber index!, BBjString column!, BBjNumber keyPress!, BBjString charPress!, BBjString floating!)
+ #setStartCellEditing(str(index!), column!, keyPress!, charPress!, floating!)
+ methodend
+ rem ===========================
+ rem /**
+ rem * Start Cell Editing at the given row and column
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString key! The row key
+ rem * @param BBjString column! The column ID
+ rem */
+ method public void setStartCellEditing(BBjString key!, BBjString column!)
+ #setStartCellEditing(key!, column!, -100, "", #GRID_FLOATING_NONE())
+ methodend
+ rem /**
+ rem * Start Cell Editing at the given row and column
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber index! The row index
+ rem * @param BBjString column! The column ID
+ rem */
+ method public void setStartCellEditing(BBjNumber index!, BBjString column!)
+ #setStartCellEditing(str(index!), column!)
+ methodend
+ rem /**
+ rem * Start Cell Editing at the given row and column
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString key! The row key
+ rem * @param BBjString column! The column ID
+ rem * @param BBjString charPress! The key char to pass to the editor when the editor supports it
+ rem */
+ method public void setStartCellEditing(BBjString key!, BBjString column!, BBjString charPress!)
+ #setStartCellEditing(key!, column!, -100, charPress!, #GRID_FLOATING_NONE())
+ methodend
+ rem /**
+ rem * Start Cell Editing at the given row and column
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber index! The row index
+ rem * @param BBjString column! The column ID
+ rem * @param BBjString charPress! The key char to pass to the editor when the editor supports it
+ rem */
+ method public void setStartCellEditing(BBjNumber index!, BBjString column!, BBjString charPress!)
+ #setStartCellEditing(str(index!), column!, charPress!)
+ methodend
+ rem /**
+ rem * Start Cell Editing at the given row and column
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString key! The row key
+ rem * @param BBjString column! The column ID
+ rem * @param BBjNumber keyPress! The key code to pass to the editor when the editor supports it
+ rem */
+ method public void setStartCellEditing(BBjString key!, BBjString column!, BBjNumber keyPress!)
+ #setStartCellEditing(key!, column!, keyPress!, "", #GRID_FLOATING_NONE())
+ methodend
+ rem /**
+ rem * Start Cell Editing at the given row and column
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber index! The row index
+ rem * @param BBjString column! The column ID
+ rem * @param BBjNumber keyPress! The key code to pass to the editor when the editor supports it
+ rem */
+ method public void setStartCellEditing(BBjNumber index!, BBjString column!, BBjNumber keyPress!)
+ #setStartCellEditing(str(index!), column!, keyPress!)
+ methodend
+ rem /**
+ rem * Navigates the grid focus to the next cell, as if tabbing.
+ rem *
+ rem *
#API
+ rem *
+ rem * @deprecated since version 0.101.0, BBjGridExWidget.startNextCellEditing() is deprecated / renamed. Use BBjGridExWidget.tabToNextCell() instead.
+ rem */
+ method public void startNextCellEditing()
+ GxLogger.warn("since version 0.101.0, BBjGridExWidget.startNextCellEditing() is deprecated / renamed. Use BBjGridExWidget.tabToNextCell() instead.")
+ #tabToNextCell()
+ methodend
+ rem /**
+ rem * Navigates the grid focus to the previous cell, as if shift-tabbing.
+ rem *
+ rem *
#API
+ rem *
+ rem * @deprecated since version 0.101.0, BBjGridExWidget.startPreviousCellEditing() is deprecated / renamed. Use BBjGridExWidget.tabToPreviousCell() instead.
+ rem */
+ method public void startPreviousCellEditing()
+ GxLogger.warn("since version 0.101.0, BBjGridExWidget.startPreviousCellEditing() is deprecated / renamed. Use BBjGridExWidget.tabToPreviousCell() instead.")
+ #tabToPreviousCell()
+ methodend
+ rem /**
+ rem * Stop editing and accepts changes
+ rem *
+ rem *
#API
+ rem */
+ method public void stopEditing()
+ #getExecutor().execute("$wnd.gw_stopEditing('" + #getRootId() + "',0)")
+ methodend
+ rem /**
+ rem * Stop Editing
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjNumber cancel!: 1 = discard changes, 0 = accept changes
+ rem */
+ method public void stopEditing(BBjNumber cancel!)
+ #getExecutor().execute("$wnd.gw_stopEditing('"+ #getRootId() + "'," + STR(cancel!)+ ")")
+ methodend
+ rem /**
+ rem * If true, then row group, pivot and value aggregation will be read only from the Ui.
+ rem * The grid will display what values are used for each, but will not allow the use to change the selection
+ rem *
+ rem *
#Enterprise
+ rem *
#Configuration
+ rem *
#API
+ rem *
+ rem * @param BBjNumber readonly! when true disable, enable otherwise
+ rem */
+ method public void setFunctionsReadOnly(BBjNumber readonly!)
+ #getOptions().setFunctionsReadOnly(readonly!)
+ scriptKey! = "$wnd.gw_setFunctionsReadOnly"
+ #getExecutor().execute(scriptKey!,"$wnd.gw_setFunctionsReadOnly('" + #getRootId() + "'," + str(readonly!) +")")
+ methodend
+ rem /**
+ rem * Sync the client row data every time a new GxClientRowModel
+ rem * is composed by the grid.
+ rem *
+ rem * Use this method if the row's data in the client is different that the row's data in
+ rem * the ResultSet
+ rem *
+ rem * @param BBjNumber include! when true the ClientRow field will always be filled in GxClientRowModel
+ rem * otherwise it will always be null().
+ rem *
+ rem *
#Configuration
+ rem *
#API
+ rem */
+ method public void includeClientRowDataInRowModels(BBjNumber include!)
+ #getClientContext().addProperty("includeClientRowData",include!.booleanValue())
+ #updateContext()
+ methodend
+ rem /**
+ rem * The method will return a vector of the selected ranges including columns and rows
+ rem *
+ rem *
#API
+ rem *
+ rem * @return BBjVector
+ rem */
+ method public BBjVector getRangeSelections()
+ rem an array to save the parsed range selections
+ rangeSelectionVector! = new BBjVector()
+ rem get the range selections from the client
+ rem the client will return an array of objects where each object is a range
+ rangeSelections! = #getExecutor().execute("$wnd.gw_getRangeSelections('" + #getRootId() + "')",0)
+
+ if (rangeSelections! = "[]") then
+ goto getSelectionRangeErr
+ FI
+ rem iterate throw the ranges array and parse the range objects
+ parser! = new JsonParser()
+ ranges! = parser!.parse(rangeSelections!).getAsJsonArray()
+ rangesIterator! = ranges!.iterator()
+ while (rangesIterator!.hasNext())
+ model! = #getClientJsonFactory().getRangeSelection(rangesIterator!.next().getAsJsonObject())
+ rangeSelectionVector!.addItem(model!)
+ wend
+
+ getSelectionRangeErr:
+ methodret rangeSelectionVector!
+ methodend
+ rem /**
+ rem * Add new range selection
+ rem *
+ rem *
#API
+ rem *
+ rem * @param GxClientAddRangeSelectionModel model! the add selection model
+ rem *
+ rem * @return GxClientAddRangeSelectionModel
+ rem */
+ method public GxClientAddRangeSelectionModel addRangeSelection(GxClientAddRangeSelectionModel model!)
+ #getExecutor().execute("$wnd.gw_addCellRange('" + #getRootId() + "'," + model!.getAsJsonObject().toString() + ")")
+ methodret model!
+ methodend
+ rem /**
+ rem * Add new range selection
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! columns as comma separated string (ex: CDNUMBER, COST)
+ rem * @param BBjString start! start row id or index
+ rem * @param BBjString end! end row id or index
+ rem *
+ rem * @return GxClientAddRangeSelectionModel
+ rem */
+ method public GxClientAddRangeSelectionModel addRangeSelection(BBjString columns! , BBjString start! , BBjString end!)
+ model! = new GxClientAddRangeSelectionModel()
+ model!.setColumns(columns!)
+ model!.setStart(start!)
+ model!.setEnd(end!)
+ methodret #addRangeSelection(model!)
+ methodend
+ rem /**
+ rem * Add new range selection
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! columns as comma separated string (ex: CDNUMBER, COST)
+ rem * @param BBjNumber start! start row id or index
+ rem * @param BBjNumber end! end row id or index
+ rem *
+ rem * @return GxClientAddRangeSelectionModel
+ rem */
+ method public GxClientAddRangeSelectionModel addRangeSelection(BBjString columns! , BBjNumber start! , BBjNumber end!)
+ methodret #addRangeSelection(columns! , str(start!),str(end!))
+ methodend
+ rem /**
+ rem * Add new range selection
+ rem *
+ rem *
#API
+ rem *
+ rem * @param BBjString columns! columns as comma separated string (ex: CDNUMBER, COST)
+ rem *
+ rem * @return GxClientAddRangeSelectionModel
+ rem */
+ method public GxClientAddRangeSelectionModel addRangeSelection(BBjString columns!)
+ methodret #addRangeSelection(columns!,null() , null())
+ methodend
+ rem /**
+ rem * Clears the selected range.
+ rem *
+ rem *
#API
+ rem */
+ method public void clearRangeSelection()
+ #getExecutor().execute("$wnd.gw_clearRangeSelection('" + #getRootId() + "')",0)
+ methodend
+ rem /**
+ rem * Clear already created charts.
+ rem * Note that this method does not clear user created charts
+ rem *
+ rem *
#API
+ rem *
+ rem * @param GxClientAddRangeChartModel model! the add range model
+ rem * @return BBjString A unique id for the created chart
+ rem */
+ method public BBjString addRangeChart(GxClientAddRangeChartModel model!)
+ uuid! = #getExecutor().execute("$wnd.gw_addChartRange('" + #getRootId() + "'," + model!.getAsJsonObject().toString() + ")" , 0)
+ methodret str(uuid!)
+ methodend
+ rem /**
+ rem * Clear already created chart by its id
+ rem *
+ rem *
#API
+ rem * Note that this method does not clear user created charts
+ rem *
+ rem * @param BBjString id! the chart's id to destroy
+ rem */
+ method public void clearChart(BBjString id!)
+ rem /**
+ rem * Even Though the `gw_destroyChart` function does not return any value
+ rem * we don't debounce the call because the developer might call
+ rem * `addRangeChart` before calling this method. and `addRangeChart` is not debounced call
+ rem * which will lead the chart to be created and then destroy directly
+ rem */
+ #getExecutor().execute("$wnd.gw_destroyChart('" + #getRootId() + "','" + str(id!) + "')",0)
+ methodend
+ rem /**
+ rem * Clear already created charts.
+ rem * Note that this method does not clear user created charts
+ rem *
+ rem *
#API
+ rem */
+ method public void clearChart()
+ rem /**
+ rem * Even Though the `gw_destroyChart` function does not return any value
+ rem * we don't debounce the call because the developer might call
+ rem * `addRangeChart` before calling this method. and `addRangeChart` is not debounced call
+ rem * which will lead the chart to be created and then destroy directly
+ rem */
+ #getExecutor().execute("$wnd.gw_destroyChart('" + #getRootId() + "')",0)
+ methodend
+ rem /**
+ rem * Show loading overlay
+ rem *
+ rem *
#API
+ rem */
+ method public void showLoadingOverlay()
+ #getExecutor().execute("$wnd.gw_showLoadingOverlay('" + #getRootId() + "')", 0)
+ methodend
+ rem /**
+ rem * Show 'no rows' overlay
+ rem *
+ rem *
#API
+ rem */
+ method public void showNoRowsOverlay()
+ #getExecutor().execute("$wnd.gw_showNoRowsOverlay('" + #getRootId() + "')", 0)
+ methodend
+ rem /**
+ rem * Clear all overlays
+ rem *
+ rem *
#API
+ rem */
+ method public void hideOverlay()
+ #getExecutor().execute("$wnd.gw_hideOverlay('" + #getRootId() + "')", 0)
+ methodend
+ rem /**
+ rem * Destroy the grid
+ rem */
+ method public void destroy()
+ #super!.destroy()
+ #IsReady! = BBjAPI.FALSE
+ methodend
+
+ rem /**
+ rem * Align the current grid with the passed one
+ rem *
+ rem * Aligning two or more grids means columns will be kept aligned in all grids.
+ rem * In other words, column changes to one grid (column width, column order, column visibility etc)
+ rem * are reflected in the other grid. This is useful if you have two grids, one above the other such
+ rem * that their columns are vertically aligned, and you want to keep the columns aligned.
+ rem *
+ rem * @param BBjGridExWidget widget!
+ rem */
+ method public void addAlignedGrid(BBjGridExWidget widget!)
+ #getExecutor().execute("$wnd.gw_addAlignedGrid('" + #getRootId() + "','" + widget!.getRootId() + "')", 0)
+ methodend
+ rem /**
+ rem * Disable the current grid alignment with the passed one
+ rem *
+ rem * @param BBjGridExWidget widget!
+ rem */
+ method public void removeAlignedGrid(BBjGridExWidget widget!)
+ #getExecutor().execute("$wnd.gw_removeAlignedGrid('" + #getRootId() + "','" + widget!.getRootId() + "')", 0)
+ methodend
+ rem /**
+ rem * Fires an event
+ rem *
+ rem * @param Int type! The event's type
+ rem * @param Object payload! The event's payload
+ rem *
+ rem * @Override
+ rem */
+ method protected void fireEvent(int type!, Object payload!)
+ el! = new JsonPrimitive(type!)
+
+ if(#getInterests().contains(el!)) then
+ #super!.fireEvent(type!,payload!)
+ FI
+ methodend
+ rem /**
+ rem * Send the current interests to the client
+ rem */
+ method protected void updateClientWithInterests()
+ #getClientContext().add("interests",#getInterests())
+ #updateContext()
+ methodend
+ rem /**
+ rem * The method will add the default chart toolbar items
+ rem */
+ method protected void fillChartToolbarItems()
+ #getChartToolbarItems().add(#CHART_TOOLBAR_SETTINGS())
+ #getChartToolbarItems().add(#CHART_TOOLBAR_DATA())
+ #getChartToolbarItems().add(#CHART_TOOLBAR_FORMAT())
+ #getChartToolbarItems().add(#CHART_TOOLBAR_DOWNLOAD())
+ methodend
+ rem /**
+ rem * Get the grid template
+ rem *
+ rem * @return BBjString parsed html template
+ rem */
+ method protected BBjString getTemplate()
+ html$ = #Template$
+
+ if(len(html$) = 0) then
+ ch=unt
+ open (ch)"BBjGridExWidget/client/index.html"
+ read record (ch,siz=5512000)html$
+ close (ch)
+ FI
+
+ html! = html$
+ html! = html!.replaceAll("__id__" , #getRootId())
+ html! = html!.replaceAll("__lang__", #getLanguageManager().getLanguage())
+ html! = html!.replaceAll("__THEME__", "ag-theme-" + #getOptions().getTheme())
+ methodret html!
+ methodend
+
+ method protected void handleStateChangedEvent(BBjString detail$, BBjNumber type!)
+ event! = #getState()
+ #fireEvent(type!, event!)
+ methodend
+ rem /**
+ rem * Handle Range Selections Event
+ rem *
+ rem * @see GxClientEventsRangeSelection
+ rem */
+ method private void onRangeSelectionChange(BBjString detail$)
+ event! = new GxClientEventsRangeSelection()
+ #fireEvent(#ON_GRID_RANGE_SELECTION_CHANGED(),event!)
+ methodend
+ rem /**
+ rem * On rows selections event
+ rem *
+ rem * Parse the json details coming from the client and fires new GxSelectRowEvent
+ rem *
+ rem * @param BBjString detail$ The event detail as Json
+ rem * @param BBjNumber type! The event type
+ rem *
+ rem * @see GxSelectRowEvent
+ rem */
+ method protected void onSelectRowChange(BBjString detail$, BBjNumber type!)
+ declare GxClientEventsRowSelection event!
+ declare JsonParser parser!
+
+ event! = new GxClientEventsRowSelection()
+ event!.setSelectedRows(#getSelectedRows())
+ rem report keypress for click events only
+ if(type! = #ON_GRID_ROW_CLICK() OR type! = #ON_GRID_DOUBLE_CLICK())
+ parser! = new JsonParser()
+ detailsAsJson! = parser!.parse(detail$).getAsJsonObject()
+ keypress! = null()
+
+ if(detailsAsJson!.has("k") AND detailsAsJson!.get("k").isJsonNull() = BBjAPI.FALSE) then
+ keypress! = #getClientJsonFactory().getKeypress(detailsAsJson!.get("k").getAsJsonObject())
+ fi
+
+ event!.setKey(keypress!)
+ fi
+
+ #fireEvent(type!,event!)
+ methodend
+ rem /**
+ rem * On context menu event
+ rem *
+ rem * @param BBjString detail$ The event response
+ rem */
+ method protected void onContextmenuEvent(BBjString detail$)
+ declare JsonParser parser!
+
+ parser! = new JsonParser()
+ parsedCell! = parser!.parse(detail$).getAsJsonObject()
+ cell! = #getClientJsonFactory().getCell(parsedCell!)
+ event! = new GxClientEventsContextMenu()
+ event!.setCell(cell!)
+ #fireEvent(parsedCell!.get("i").getAsInt(),event!)
+ methodend
+ rem /**
+ rem * On cell Event. handles cell clicking and editing events
+ rem *
+ rem * @param BBjString detail$ The event detail as Json
+ rem * @param BBjNumber type! The event type
+ rem *
+ rem * @see ON_GRID_CELL_VALUE_CHANGED()
+ rem * @see ON_GRID_CELL_DOUBLE_CLICK()
+ rem * @see ON_GRID_CELL_CLICK()
+ rem */
+ method protected void onCellEvent(BBjString detail$ , BBjNumber type!)
+ declare JsonParser parser!
+
+ parser! = new JsonParser()
+ parsedCell! = parser!.parse(detail$).getAsJsonObject()
+ cell! = #getClientJsonFactory().getCell(parsedCell!)
+ event! = new GxClientEventsCell()
+ event!.setCell(cell!)
+ event!.setOldValue(parsedCell!.get("o").getAsString(), err=*next)
+
+ if(type! = #ON_GRID_CELL_CLICK() OR type! = #ON_GRID_CELL_DOUBLE_CLICK())
+ if(parsedCell!.has("k") AND parsedCell!.get("k").isJsonNull() = BBjAPI.FALSE) then
+ keypress! = #getClientJsonFactory().getKeypress(parsedCell!.get("k").getAsJsonObject())
+ event!.setKey(keypress!)
+ fi
+ fi
+
+ #fireEvent(type!, event!)
+ methodend
+ rem /**
+ rem * Fire an row editing event when row editing starts or stops
+ rem *
+ rem * @param BBjString detail$ The event detail as json
+ rem * @param BBjNumber type! The event type
+ rem *
+ rem * @see ON_GRID_ROW_EDITING_STARTED()
+ rem * @see ON_GRID_ROW_EDITING_STOPPED()
+ rem */
+ method protected void onRowEditing(BBjString detail$ , BBjNumber type!)
+ event! = new GxClientEventsRowEditing()
+ event!.setRow(#getClientJsonFactory().getRow(detail$))
+ #fireEvent(type!, event!)
+ methodend
+ rem /**
+ rem * Fire an keypress event when keypress is passed from the client
+ rem *
+ rem * @param BBjString detail$ The event detail as json
+ rem *
+ rem * @see ON_GRID_KEYPRESS()
+ rem */
+ method protected void onKeypressEvent(BBjString detail$)
+ declare JsonParser parser!
+
+ parser! = new JsonParser()
+ parsedKeypress! = parser!.parse(detail$).getAsJsonObject()
+ keypress! = #getClientJsonFactory().getKeypress(parsedKeypress!)
+ event! = new GxClientEventsKeypress()
event!.setKey(keypress!)
- fi
- fi
-
- #fireEvent(type!, event!)
- methodend
- rem /**
- rem * Fire an row editing event when row editing starts or stops
- rem *
- rem * @param BBjString detail$ The event detail as json
- rem * @param BBjNumber type! The event type
- rem *
- rem * @see ON_GRID_ROW_EDITING_STARTED()
- rem * @see ON_GRID_ROW_EDITING_STOPPED()
- rem */
- method protected void onRowEditing(BBjString detail$ , BBjNumber type!)
- event! = new GxClientEventsRowEditing()
- event!.setRow(#getClientJsonFactory().getRow(detail$))
- #fireEvent(type!, event!)
- methodend
- rem /**
- rem * Fire an keypress event when keypress is passed from the client
- rem *
- rem * @param BBjString detail$ The event detail as json
- rem *
- rem * @see ON_GRID_KEYPRESS()
- rem */
- method protected void onKeypressEvent(BBjString detail$)
- declare JsonParser parser!
-
- parser! = new JsonParser()
- parsedKeypress! = parser!.parse(detail$).getAsJsonObject()
- keypress! = #getClientJsonFactory().getKeypress(parsedKeypress!)
- event! = new GxClientEventsKeypress()
- event!.setKey(keypress!)
- #fireEvent(#ON_GRID_KEYPRESS(), event!)
- methodend
- rem /**
- rem * Call the cell editor resolver on the passed column
- rem *
- rem * @param BBjString detail$ The event detail as json
- rem */
- method protected void onSuggestionEvent(BBjString detail$)
- declare JsonParser parser!
-
- parser! = new JsonParser()
- parsedDetail! = parser!.parse(detail$).getAsJsonObject()
- columnName! = parsedDetail!.get("column").getAsString()
-
- if(#hasColumn(columnName!)) then
- cellEditor! = #getColumn(columnName!).getCellEditor()
- resolver! = cellEditor!.getResolver()
- id! = parsedDetail!.get("id").getAsString()
- text! = parsedDetail!.get("text").getAsString()
- row! = parsedDetail!.get("row").getAsJsonObject()
- columnModel! = #getClientJsonFactory().getColumn(columnName!)
- rowModel! = #getClientJsonFactory().getRow(row!)
- data! = resolver!.resolve(text!, columnModel!, rowModel!)
- script! = String.format("$doc.dispatchEvent(new CustomEvent('%s', { detail: %s }))", id!, data!.toString())
- #getExecutor().execute(script!)
- fi
- methodend
- rem /**
- rem * Fire a filter changed event
- rem *
- rem * @see ON_GRID_FILTER_CHANGED()
- rem */
- method protected void onFilterChangedEvent()
- #fireEvent(#ON_GRID_FILTER_CHANGED(),null())
- methodend
- rem /**
- rem * Fire a ready event
- rem *
- rem * @see ON_GRID_READY()
- rem */
- method protected void onGridReadyEvent()
- #fireEvent(#ON_GRID_READY(),#this!)
- methodend
+ #fireEvent(#ON_GRID_KEYPRESS(), event!)
+ methodend
+ rem /**
+ rem * Call the cell editor resolver on the passed column
+ rem *
+ rem * @param BBjString detail$ The event detail as json
+ rem */
+ method protected void onSuggestionEvent(BBjString detail$)
+ declare JsonParser parser!
+
+ parser! = new JsonParser()
+ parsedDetail! = parser!.parse(detail$).getAsJsonObject()
+ columnName! = parsedDetail!.get("column").getAsString()
+
+ if(#hasColumn(columnName!)) then
+ cellEditor! = #getColumn(columnName!).getCellEditor()
+ resolver! = cellEditor!.getResolver()
+ id! = parsedDetail!.get("id").getAsString()
+ text! = parsedDetail!.get("text").getAsString()
+ row! = parsedDetail!.get("row").getAsJsonObject()
+ columnModel! = #getClientJsonFactory().getColumn(columnName!)
+ rowModel! = #getClientJsonFactory().getRow(row!)
+ data! = resolver!.resolve(text!, columnModel!, rowModel!)
+ script! = String.format("$doc.dispatchEvent(new CustomEvent('%s', { detail: %s }))", id!, data!.toString())
+ #getExecutor().execute(script!)
+ fi
+ methodend
+ rem /**
+ rem * Fire a filter changed event
+ rem *
+ rem * @see ON_GRID_FILTER_CHANGED()
+ rem */
+ method protected void onFilterChangedEvent()
+ #fireEvent(#ON_GRID_FILTER_CHANGED(),null())
+ methodend
+ rem /**
+ rem * Fire a ready event
+ rem *
+ rem * @see ON_GRID_READY()
+ rem */
+ method protected void onGridReadyEvent()
+ #fireEvent(#ON_GRID_READY(),#this!)
+ methodend
classend
diff --git a/client/dist/bbj-grid-widget.js b/client/dist/bbj-grid-widget.js
index f2d5ddad..de1d03a6 100644
--- a/client/dist/bbj-grid-widget.js
+++ b/client/dist/bbj-grid-widget.js
@@ -81,3614 +81,3459 @@
/******/
/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 40);
+/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
-/******/ ([
-/* 0 */
+/******/ ({
+
+/***/ "./node_modules/autocompleter/autocomplete.js":
+/*!****************************************************!*\
+ !*** ./node_modules/autocompleter/autocomplete.js ***!
+ \****************************************************/
+/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
+var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.gw_getDocument = gw_getDocument;
-exports.gw_getWindow = gw_getWindow;
-exports.gw_escape = gw_escape;
-exports.gw_uuid = gw_uuid;
-exports.gw_getGrid = gw_getGrid;
-exports.gw_addGrid = gw_addGrid;
+(function (global, factory) {
+ ( false ? undefined : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
+ __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
+ (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
+ __WEBPACK_AMD_DEFINE_FACTORY__),
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (undefined);
+})(void 0, function () {
+ 'use strict';
+ /*
+ * https://github.com/kraaden/autocomplete
+ * Copyright (c) 2016 Denys Krasnoshchok
+ * MIT License
+ */
-/*
- * This file is part of the BBjGridExWidget plugin.
- * (c) Basis Europe
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
+ function autocomplete(settings) {
+ // just an alias to minimize JS file size
+ var doc = document;
+ var container = doc.createElement("div");
+ var containerStyle = container.style;
+ var userAgent = navigator.userAgent;
+ var mobileFirefox = userAgent.indexOf("Firefox") !== -1 && userAgent.indexOf("Mobile") !== -1;
+ var debounceWaitMs = settings.debounceWaitMs || 0;
+ var preventSubmit = settings.preventSubmit || false; // 'keyup' event will not be fired on Mobile Firefox, so we have to use 'input' event instead
-/**
- * Get document
- *
- * Get the document instance according to the current BBj env
- *
- * @return {Object} Document instance
- */
-function gw_getDocument() {
- return typeof $doc !== 'undefined' ? $doc : document;
-}
-/**
- * Get window
- *
- * Get the window instance according to the current BBj env
- *
- * @return {Object} Window instance
- */
+ var keyUpEventName = mobileFirefox ? "input" : "keyup";
+ var items = [];
+ var inputValue = "";
+ var minLen = 2;
+ var showOnFocus = settings.showOnFocus;
+ var selected;
+ var keypressCounter = 0;
+ var debounceTimer;
+ if (settings.minLength !== undefined) {
+ minLen = settings.minLength;
+ }
-function gw_getWindow() {
- return typeof $wnd !== 'undefined' ? $wnd : window;
-}
-/**
- * Escape Value
- *
- * Change null and undefined to empty string
- *
- * @param {*} value
- *
- * @return {String} escaped value
- */
+ if (!settings.input) {
+ throw new Error("input undefined");
+ }
+ var input = settings.input;
+ container.className = "autocomplete " + (settings.className || ""); // IOS implementation for fixed positioning has many bugs, so we will use absolute positioning
-function gw_escape(value) {
- return value !== null && value !== undefined ? value : '';
-}
-/**
- * Generate a unique uuid
- * @see https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
- */
+ containerStyle.position = "absolute";
+ /**
+ * Detach the container from DOM
+ */
+ function detach() {
+ var parent = container.parentNode;
-function gw_uuid() {
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
- var r = Math.random() * 16 | 0,
- v = c == 'x' ? r : r & 0x3 | 0x8;
- return v.toString(16);
- });
-}
-/**
- * Get Grid
- *
- * Retrieve the grid instance from `window.BBjGridExWidget` array
- *
- * @param {String} id The grid's id
- *
- * @return {Object|null} The grid's instance ofr null
- * @throws TypeError when the grid instance is not found
- */
+ if (parent) {
+ parent.removeChild(container);
+ }
+ }
+ /**
+ * Clear debouncing timer if assigned
+ */
-function gw_getGrid(id) {
- window.BBjGridExWidget = window.BBjGridExWidget || {};
- var grid = window.BBjGridExWidget[id] || null;
+ function clearDebounceTimer() {
+ if (debounceTimer) {
+ window.clearTimeout(debounceTimer);
+ }
+ }
+ /**
+ * Attach the container to DOM
+ */
- if (!grid) {
- var registeredGrids = JSON.stringify(Object.keys(window.BBjGridExWidget)); //getFuncArgs(func).forEach((key, i) => argsObj[key] = args[i]);
- throw new TypeError("\n\n[Grid Not Found] The method asked for non-existent grid instance.\n-------------------------------------------------------------------\nRequired Grid Id : ".concat(id, " \nRegistered Grids : ").concat(registeredGrids, "\n"));
- }
+ function attach() {
+ if (!container.parentNode) {
+ doc.body.appendChild(container);
+ }
+ }
+ /**
+ * Check if container for autocomplete is displayed
+ */
- return grid;
-}
-/**
- * Add Grid
- *
- * Store a new grid instance by in the `window.BBjGridExWidget` array
- *
- * @param {String} id The grid's id
- * @param {Object} options The grid's options
- *
- * @return {Object} Stored grid
- */
+ function containerDisplayed() {
+ return !!container.parentNode;
+ }
+ /**
+ * Clear autocomplete state and hide container
+ */
-function gw_addGrid(id, options) {
- window.BBjGridExWidget = window.BBjGridExWidget || {};
- window.BBjGridExWidget[id] = options;
- return gw_getGrid(id);
-}
-/***/ }),
-/* 1 */
-/***/ (function(module, exports, __webpack_require__) {
+ function clear() {
+ // prevent the update call if there are pending AJAX requests
+ keypressCounter++;
+ items = [];
+ inputValue = "";
+ selected = undefined;
+ detach();
+ }
+ /**
+ * Update autocomplete position
+ */
-"use strict";
+ function updatePosition() {
+ if (!containerDisplayed()) {
+ return;
+ }
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.gw_debounce = gw_debounce;
-exports.gw_sendEvent = gw_sendEvent;
-exports.gw_parseNode = gw_parseNode;
-exports.gw_parseNodeFromEvent = gw_parseNodeFromEvent;
+ containerStyle.height = "auto";
+ containerStyle.width = input.offsetWidth + "px";
+ var maxHeight = 0;
+ var inputRect;
-var _utilities = __webpack_require__(0);
+ function calc() {
+ var docEl = doc.documentElement;
+ var clientTop = docEl.clientTop || doc.body.clientTop || 0;
+ var clientLeft = docEl.clientLeft || doc.body.clientLeft || 0;
+ var scrollTop = window.pageYOffset || docEl.scrollTop;
+ var scrollLeft = window.pageXOffset || docEl.scrollLeft;
+ inputRect = input.getBoundingClientRect();
+ var top = inputRect.top + input.offsetHeight + scrollTop - clientTop;
+ var left = inputRect.left + scrollLeft - clientLeft;
+ containerStyle.top = top + "px";
+ containerStyle.left = left + "px";
+ maxHeight = window.innerHeight - (inputRect.top + input.offsetHeight);
-/* eslint-disable no-prototype-builtins */
+ if (maxHeight < 0) {
+ maxHeight = 0;
+ }
-/*
- * This file is part of the BBjGridExWidget plugin.
- * (c) Basis Europe
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
+ containerStyle.top = top + "px";
+ containerStyle.bottom = "";
+ containerStyle.left = left + "px";
+ containerStyle.maxHeight = maxHeight + "px";
+ } // the calc method must be called twice, otherwise the calculation may be wrong on resize event (chrome browser)
-/** https://davidwalsh.name/javascript-debounce-function */
-function gw_debounce(func, wait, immediate) {
- var timeout;
- return function () {
- var context = this,
- args = arguments;
- var later = function later() {
- timeout = null;
+ calc();
+ calc();
- if (!immediate) {
- func.apply(context, args);
+ if (settings.customize && inputRect) {
+ settings.customize(input, inputRect, container, maxHeight);
}
- };
+ }
+ /**
+ * Redraw the autocomplete div element with suggestions
+ */
- var callNow = immediate && !timeout;
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- if (callNow) {
- func.apply(context, args);
- }
- };
-}
-/**
- * Send an event to BBj side
- *
- * @param {Array} context the grid's context
- * @param {*} payload the event payload
- * @param {String} eventId the event's id
- */
+ function update() {
+ // delete all children from autocomplete DOM container
+ while (container.firstChild) {
+ container.removeChild(container.firstChild);
+ } // function for rendering autocomplete suggestions
-function gw_sendEvent(context) {
- var payload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var eventId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
- var registeredInterests = context.interests || [];
+ var render = function render(item, currentValue) {
+ var itemElement = doc.createElement("div");
+ itemElement.textContent = item.label || "";
+ return itemElement;
+ };
- if (registeredInterests.includes(eventId)) {
- var div = (0, _utilities.gw_getDocument)().getElementById("".concat(context.id)); // bui or webapp
+ if (settings.render) {
+ render = settings.render;
+ } // function to render autocomplete groups
- if ([5, 6].indexOf(context.platform) > -1) {
- var htmlviewId = "htmlview-".concat(context.id);
- var container = (0, _utilities.gw_getDocument)().getElementsByClassName(htmlviewId)[0];
- if (typeof container.basisDispatchCustomEvent === 'function') {
- container.basisDispatchCustomEvent(div, payload);
- } else {
- window.basisDispatchCustomEvent(div, payload);
+ var renderGroup = function renderGroup(groupName, currentValue) {
+ var groupDiv = doc.createElement("div");
+ groupDiv.textContent = groupName;
+ return groupDiv;
+ };
+
+ if (settings.renderGroup) {
+ renderGroup = settings.renderGroup;
}
- } else {
- window.basisDispatchCustomEvent(div, payload);
- }
- }
-}
-/**
- * @typedef {Object} BBjGridExWidgetRow
- *
- * @property {number} id
- * @property {number} index
- * @property {number} parentKey
- * @property {number} childIndex
- * @property {boolean} selected
- */
-/**
- * Parse a node as BBjGridExWidgetRow
- *
- * @param {Object} node ag grid node
- * @param {Object} context ag grid context
- *
- * @returns {BBjGridExWidgetRow|Boolean} object formatted as BBjGridExWidgetRow.
- * false if the node is for group node
- */
+ var fragment = doc.createDocumentFragment();
+ var prevGroup = "#9?$";
+ items.forEach(function (item) {
+ if (item.group && item.group !== prevGroup) {
+ prevGroup = item.group;
+ var groupDiv = renderGroup(item.group, inputValue);
+ if (groupDiv) {
+ groupDiv.className += " group";
+ fragment.appendChild(groupDiv);
+ }
+ }
-function gw_parseNode(node, context) {
- if (true === node.group) {
- return false;
- } // we do not manage groups
+ var div = render(item, inputValue);
+ if (div) {
+ div.addEventListener("click", function (ev) {
+ settings.onSelect(item, input);
+ clear();
+ ev.preventDefault();
+ ev.stopPropagation();
+ });
- var getRowNodeId = node.rowPinned ? '__ROW_INDEX' : context.getRowNodeId;
- return {
- i: context.hasOwnProperty('getRowNodeId') && node.data[getRowNodeId] ? node.data[getRowNodeId] : node.id,
- // id
- x: node.rowIndex,
- // index
- p: node.hasOwnProperty('parent') && node.parent.hasOwnProperty('key') ? node.parent.key : '',
- // parent key
- c: node.rowPinned ? -1 : node.childIndex,
- //childIndex
- s: Boolean(node.selected),
- // selected
- // client row
- cr: context.hasOwnProperty('includeClientRowData') && context['includeClientRowData'] === true ? node.data : null,
- pp: node.rowPinned // pin position
+ if (item === selected) {
+ div.className += " selected";
+ }
- };
-}
-/**
- * Parse node from event
- *
- * Parse node in the paSsed event as BBjGridExWidgetRow
- *
- * @param {Object} e
- *
- * @returns {BBjGridExWidgetRow}
- */
+ fragment.appendChild(div);
+ }
+ });
+ container.appendChild(fragment);
+ if (items.length < 1) {
+ if (settings.emptyMsg) {
+ var empty = doc.createElement("div");
+ empty.className = "empty";
+ empty.textContent = settings.emptyMsg;
+ container.appendChild(empty);
+ } else {
+ clear();
+ return;
+ }
+ }
-function gw_parseNodeFromEvent(e) {
- return gw_parseNode(e.node, e.context);
-}
+ attach();
+ updatePosition();
+ updateScroll();
+ }
-/***/ }),
-/* 2 */
-/***/ (function(module, exports, __webpack_require__) {
+ function updateIfDisplayed() {
+ if (containerDisplayed()) {
+ update();
+ }
+ }
-"use strict";
+ function resizeEventHandler() {
+ updateIfDisplayed();
+ }
+ function scrollEventHandler(e) {
+ if (e.target !== container) {
+ updateIfDisplayed();
+ } else {
+ e.preventDefault();
+ }
+ }
-function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+ function keyupEventHandler(ev) {
+ var keyCode = ev.which || ev.keyCode || 0;
+ var ignore = [38
+ /* Up */
+ , 13
+ /* Enter */
+ , 27
+ /* Esc */
+ , 39
+ /* Right */
+ , 37
+ /* Left */
+ , 16
+ /* Shift */
+ , 17
+ /* Ctrl */
+ , 18
+ /* Alt */
+ , 20
+ /* CapsLock */
+ , 91
+ /* WindowsKey */
+ , 9
+ /* Tab */
+ ];
-var g; // This works in non-strict mode
+ for (var _i = 0, ignore_1 = ignore; _i < ignore_1.length; _i++) {
+ var key = ignore_1[_i];
-g = function () {
- return this;
-}();
+ if (keyCode === key) {
+ return;
+ }
+ }
-try {
- // This works if eval is allowed (see CSP)
- g = g || new Function("return this")();
-} catch (e) {
- // This works if the window reference is available
- if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
-} // g can still be undefined, but nothing to do about it...
-// We return undefined, instead of nothing here, so it's
-// easier to handle this case. if(!global) { ...}
+ if (keyCode >= 112
+ /* F1 */
+ && keyCode <= 123
+ /* F12 */
+ ) {
+ return;
+ } // the down key is used to open autocomplete
-module.exports = g;
+ if (keyCode === 40
+ /* Down */
+ && containerDisplayed()) {
+ return;
+ }
-/***/ }),
-/* 3 */
-/***/ (function(module, exports, __webpack_require__) {
+ startFetch(0
+ /* Keyboard */
+ );
+ }
+ /**
+ * Automatically move scroll bar if selected item is not visible
+ */
-"use strict";
+ function updateScroll() {
+ var elements = container.getElementsByClassName("selected");
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.GW_EVENT_READY = exports.GW_EVENT_FILTER_CHANGED = exports.GW_EVENT_KEYPRESS = exports.GW_EVENT_RANGE_SELECTION_CHANGED = exports.GW_EVENT_GRID_STATE_CHANGE = exports.GW_EVENT_ROW_VALUE_CHANGED = exports.GW_EVENT_ROW_EDITING_STOPPED = exports.GW_EVENT_ROW_EDITING_STARTED = exports.GW_EVENT_CELL_VALUE_CHANGED = exports.GW_EVENT_CELL_EDITING_STOPPED = exports.GW_EVENT_CELL_EDITING_STARTED = exports.GW_EVENT_CELL_DOUBLE_CLICK = exports.GW_EVENT_CELL_CLICK = exports.GW_EVENT_ROW_DOUBLE_CLICK = exports.GW_EVENT_ROW_CLICK = exports.GW_EVENT_ROW_SELECT = void 0;
+ if (elements.length > 0) {
+ var element = elements[0]; // make group visible
-/*
- * This file is part of the BBjGridExWidget plugin.
- * (c) Basis Europe
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-// selection constants
-var GW_EVENT_ROW_SELECT = 69;
-exports.GW_EVENT_ROW_SELECT = GW_EVENT_ROW_SELECT;
-var GW_EVENT_ROW_CLICK = 5011;
-exports.GW_EVENT_ROW_CLICK = GW_EVENT_ROW_CLICK;
-var GW_EVENT_ROW_DOUBLE_CLICK = 52;
-exports.GW_EVENT_ROW_DOUBLE_CLICK = GW_EVENT_ROW_DOUBLE_CLICK;
-var GW_EVENT_CELL_CLICK = 5001;
-exports.GW_EVENT_CELL_CLICK = GW_EVENT_CELL_CLICK;
-var GW_EVENT_CELL_DOUBLE_CLICK = 5002; // editing constants
+ var previous = element.previousElementSibling;
-exports.GW_EVENT_CELL_DOUBLE_CLICK = GW_EVENT_CELL_DOUBLE_CLICK;
-var GW_EVENT_CELL_EDITING_STARTED = 5003;
-exports.GW_EVENT_CELL_EDITING_STARTED = GW_EVENT_CELL_EDITING_STARTED;
-var GW_EVENT_CELL_EDITING_STOPPED = 5004;
-exports.GW_EVENT_CELL_EDITING_STOPPED = GW_EVENT_CELL_EDITING_STOPPED;
-var GW_EVENT_CELL_VALUE_CHANGED = 5005;
-exports.GW_EVENT_CELL_VALUE_CHANGED = GW_EVENT_CELL_VALUE_CHANGED;
-var GW_EVENT_ROW_EDITING_STARTED = 5006;
-exports.GW_EVENT_ROW_EDITING_STARTED = GW_EVENT_ROW_EDITING_STARTED;
-var GW_EVENT_ROW_EDITING_STOPPED = 5007;
-exports.GW_EVENT_ROW_EDITING_STOPPED = GW_EVENT_ROW_EDITING_STOPPED;
-var GW_EVENT_ROW_VALUE_CHANGED = 5012; // state constants
-
-exports.GW_EVENT_ROW_VALUE_CHANGED = GW_EVENT_ROW_VALUE_CHANGED;
-var GW_EVENT_GRID_STATE_CHANGE = 5008; // range selection
+ if (previous && previous.className.indexOf("group") !== -1 && !previous.previousElementSibling) {
+ element = previous;
+ }
-exports.GW_EVENT_GRID_STATE_CHANGE = GW_EVENT_GRID_STATE_CHANGE;
-var GW_EVENT_RANGE_SELECTION_CHANGED = 5009; // keyboard events
+ if (element.offsetTop < container.scrollTop) {
+ container.scrollTop = element.offsetTop;
+ } else {
+ var selectBottom = element.offsetTop + element.offsetHeight;
+ var containerBottom = container.scrollTop + container.offsetHeight;
-exports.GW_EVENT_RANGE_SELECTION_CHANGED = GW_EVENT_RANGE_SELECTION_CHANGED;
-var GW_EVENT_KEYPRESS = 5010; // filters
+ if (selectBottom > containerBottom) {
+ container.scrollTop += selectBottom - containerBottom;
+ }
+ }
+ }
+ }
+ /**
+ * Select the previous item in suggestions
+ */
-exports.GW_EVENT_KEYPRESS = GW_EVENT_KEYPRESS;
-var GW_EVENT_FILTER_CHANGED = 5013; // ready
-exports.GW_EVENT_FILTER_CHANGED = GW_EVENT_FILTER_CHANGED;
-var GW_EVENT_READY = 5014;
-exports.GW_EVENT_READY = GW_EVENT_READY;
+ function selectPrev() {
+ if (items.length < 1) {
+ selected = undefined;
+ } else {
+ if (selected === items[0]) {
+ selected = items[items.length - 1];
+ } else {
+ for (var i = items.length - 1; i > 0; i--) {
+ if (selected === items[i] || i === 1) {
+ selected = items[i - 1];
+ break;
+ }
+ }
+ }
+ }
+ }
+ /**
+ * Select the next item in suggestions
+ */
-/***/ }),
-/* 4 */
-/***/ (function(module, exports, __webpack_require__) {
-"use strict";
+ function selectNext() {
+ if (items.length < 1) {
+ selected = undefined;
+ }
+ if (!selected || selected === items[items.length - 1]) {
+ selected = items[0];
+ return;
+ }
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = void 0;
+ for (var i = 0; i < items.length - 1; i++) {
+ if (selected === items[i]) {
+ selected = items[i + 1];
+ break;
+ }
+ }
+ }
-var _Symbol2 = _interopRequireDefault(__webpack_require__(9));
+ function keydownEventHandler(ev) {
+ var keyCode = ev.which || ev.keyCode || 0;
-var _getRawTag = _interopRequireDefault(__webpack_require__(68));
+ if (keyCode === 38
+ /* Up */
+ || keyCode === 40
+ /* Down */
+ || keyCode === 27
+ /* Esc */
+ ) {
+ var containerIsDisplayed = containerDisplayed();
-var _objectToString = _interopRequireDefault(__webpack_require__(69));
+ if (keyCode === 27
+ /* Esc */
+ ) {
+ clear();
+ } else {
+ if (!containerDisplayed || items.length < 1) {
+ return;
+ }
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ keyCode === 38
+ /* Up */
+ ? selectPrev() : selectNext();
+ update();
+ }
-/** `Object#toString` result references. */
-var nullTag = '[object Null]',
- undefinedTag = '[object Undefined]';
-/** Built-in value references. */
+ ev.preventDefault();
-var symToStringTag = _Symbol2.default ? _Symbol2.default.toStringTag : undefined;
-/**
- * The base implementation of `getTag` without fallbacks for buggy environments.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
+ if (containerIsDisplayed) {
+ ev.stopPropagation();
+ }
-function baseGetTag(value) {
- if (value == null) {
- return value === undefined ? undefinedTag : nullTag;
- }
+ return;
+ }
- return symToStringTag && symToStringTag in Object(value) ? (0, _getRawTag.default)(value) : (0, _objectToString.default)(value);
-}
+ if (keyCode === 13
+ /* Enter */
+ ) {
+ if (selected) {
+ settings.onSelect(selected, input);
+ clear();
+ }
-var _default = baseGetTag;
-exports.default = _default;
+ if (preventSubmit) {
+ ev.preventDefault();
+ }
+ }
+ }
-/***/ }),
-/* 5 */
-/***/ (function(module, exports, __webpack_require__) {
+ function focusEventHandler() {
+ if (showOnFocus) {
+ startFetch(1
+ /* Focus */
+ );
+ }
+ }
-"use strict";
+ function startFetch(trigger) {
+ // if multiple keys were pressed, before we get update from server,
+ // this may cause redrawing our autocomplete multiple times after the last key press.
+ // to avoid this, the number of times keyboard was pressed will be
+ // saved and checked before redraw our autocomplete box.
+ var savedKeypressCounter = ++keypressCounter;
+ var val = input.value;
+ if (val.length >= minLen || trigger === 1
+ /* Focus */
+ ) {
+ clearDebounceTimer();
+ debounceTimer = window.setTimeout(function () {
+ settings.fetch(val, function (elements) {
+ if (keypressCounter === savedKeypressCounter && elements) {
+ items = elements;
+ inputValue = val;
+ selected = items.length > 0 ? items[0] : undefined;
+ update();
+ }
+ }, 0
+ /* Keyboard */
+ );
+ }, trigger === 0
+ /* Keyboard */
+ ? debounceWaitMs : 0);
+ } else {
+ clear();
+ }
+ }
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = void 0;
+ function blurEventHandler() {
+ // we need to delay clear, because when we click on an item, blur will be called before click and remove items from DOM
+ setTimeout(function () {
+ if (doc.activeElement !== input) {
+ clear();
+ }
+ }, 200);
+ }
+ /**
+ * Fixes #26: on long clicks focus will be lost and onSelect method will not be called
+ */
-function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
-/**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
-function isObjectLike(value) {
- return value != null && _typeof(value) == 'object';
-}
+ container.addEventListener("mousedown", function (evt) {
+ evt.stopPropagation();
+ evt.preventDefault();
+ });
+ /**
+ * Fixes #30: autocomplete closes when scrollbar is clicked in IE
+ * See: https://stackoverflow.com/a/9210267/13172349
+ */
-var _default = isObjectLike;
-exports.default = _default;
+ container.addEventListener("focus", function () {
+ return input.focus();
+ });
+ /**
+ * This function will remove DOM elements and clear event handlers
+ */
-/***/ }),
-/* 6 */
-/***/ (function(module, exports, __webpack_require__) {
+ function destroy() {
+ input.removeEventListener("focus", focusEventHandler);
+ input.removeEventListener("keydown", keydownEventHandler);
+ input.removeEventListener(keyUpEventName, keyupEventHandler);
+ input.removeEventListener("blur", blurEventHandler);
+ window.removeEventListener("resize", resizeEventHandler);
+ doc.removeEventListener("scroll", scrollEventHandler, true);
+ clearDebounceTimer();
+ clear();
+ } // setup event handlers
-"use strict";
+ input.addEventListener("keydown", keydownEventHandler);
+ input.addEventListener(keyUpEventName, keyupEventHandler);
+ input.addEventListener("blur", blurEventHandler);
+ input.addEventListener("focus", focusEventHandler);
+ window.addEventListener("resize", resizeEventHandler);
+ doc.addEventListener("scroll", scrollEventHandler, true);
+ return {
+ destroy: destroy
+ };
+ }
-module.exports = function (module) {
- if (!module.webpackPolyfill) {
- module.deprecate = function () {};
-
- module.paths = []; // module.parent = undefined by default
-
- if (!module.children) module.children = [];
- Object.defineProperty(module, "loaded", {
- enumerable: true,
- get: function get() {
- return module.l;
- }
- });
- Object.defineProperty(module, "id", {
- enumerable: true,
- get: function get() {
- return module.i;
- }
- });
- module.webpackPolyfill = 1;
- }
-
- return module;
-};
+ return autocomplete;
+});
/***/ }),
-/* 7 */
+
+/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/basis-aggrid-components/dist/basis-aggrid-components.js":
+/*!**********************************************************************************************************************!*\
+ !*** ./node_modules/babel-loader/lib??ref--4!./node_modules/basis-aggrid-components/dist/basis-aggrid-components.js ***!
+ \**********************************************************************************************************************/
+/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
+/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
-/**
- * [Recursively parses a stringified JSON]
- * @param {[type]} jsonString [stringified json to parse]
- * @return {[type]} [normalized Javascript object]
- */
+function _typeof2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
-function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+(function webpackUniversalModuleDefinition(root, factory) {
+ if (( false ? undefined : _typeof2(exports)) === 'object' && ( false ? undefined : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
+ __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
+ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
+})(typeof self !== 'undefined' ? self : void 0, function () {
+ return (
+ /******/
+ function (modules) {
+ // webpackBootstrap
-function deepParseJson(jsonString) {
- // if not stringified json rather a simple string value then JSON.parse will throw error
- // otherwise continue recursion
- if (typeof jsonString === 'string') {
- try {
- return deepParseJson(JSON.parse(jsonString));
- } catch (err) {
- return jsonString;
- }
- } else if (Array.isArray(jsonString)) {
- // if an array is received, map over the array and deepParse each value
- return jsonString.map(function (val) {
- return deepParseJson(val);
- });
- } else if (_typeof(jsonString) === 'object' && jsonString !== null) {
- // if an object is received then deepParse each element in the object
- // typeof null returns 'object' too, so we have to eliminate that
- return Object.keys(jsonString).reduce(function (obj, key) {
- obj[key] = deepParseJson(jsonString[key]);
- return obj;
- }, {});
- } else {
- // otherwise return whatever was received
- return jsonString;
- }
-}
+ /******/
+ // The module cache
-module.exports = {
- deepParseJson: deepParseJson
-};
+ /******/
+ var installedModules = {};
+ /******/
-/***/ }),
-/* 8 */
-/***/ (function(module, exports, __webpack_require__) {
+ /******/
+ // The require function
-"use strict";
+ /******/
+ function __webpack_require__(moduleId) {
+ /******/
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = void 0;
+ /******/
+ // Check if module is in cache
-function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+ /******/
+ if (installedModules[moduleId]) {
+ /******/
+ return installedModules[moduleId].exports;
+ /******/
+ }
+ /******/
+ // Create a new module (and put it into the cache)
-/**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
-function isObject(value) {
- var type = _typeof(value);
+ /******/
- return value != null && (type == 'object' || type == 'function');
-}
-var _default = isObject;
-exports.default = _default;
+ var module = installedModules[moduleId] = {
+ /******/
+ i: moduleId,
-/***/ }),
-/* 9 */
-/***/ (function(module, exports, __webpack_require__) {
+ /******/
+ l: false,
-"use strict";
+ /******/
+ exports: {}
+ /******/
+ };
+ /******/
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = void 0;
+ /******/
+ // Execute the module function
-var _root = _interopRequireDefault(__webpack_require__(10));
+ /******/
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+ /******/
-/** Built-in value references. */
-var _Symbol = _root.default.Symbol;
-var _default = _Symbol;
-exports.default = _default;
+ /******/
+ // Flag the module as loaded
-/***/ }),
-/* 10 */
-/***/ (function(module, exports, __webpack_require__) {
+ /******/
-"use strict";
+ module.l = true;
+ /******/
+ /******/
+ // Return the exports of the module
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = void 0;
+ /******/
-var _freeGlobal = _interopRequireDefault(__webpack_require__(25));
+ return module.exports;
+ /******/
+ }
+ /******/
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ /******/
-function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+ /******/
+ // expose the modules object (__webpack_modules__)
-/** Detect free variable `self`. */
-var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' && self && self.Object === Object && self;
-/** Used as a reference to the global object. */
+ /******/
-var root = _freeGlobal.default || freeSelf || Function('return this')();
-var _default = root;
-exports.default = _default;
-/***/ }),
-/* 11 */
-/***/ (function(module, exports, __webpack_require__) {
+ __webpack_require__.m = modules;
+ /******/
-"use strict";
+ /******/
+ // expose the module cache
+ /******/
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = void 0;
+ __webpack_require__.c = installedModules;
+ /******/
-/**
- * Performs a
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * comparison between two values to determine if they are equivalent.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.eq(object, object);
- * // => true
- *
- * _.eq(object, other);
- * // => false
- *
- * _.eq('a', 'a');
- * // => true
- *
- * _.eq('a', Object('a'));
- * // => false
- *
- * _.eq(NaN, NaN);
- * // => true
- */
-function eq(value, other) {
- return value === other || value !== value && other !== other;
-}
+ /******/
+ // define getter function for harmony exports
-var _default = eq;
-exports.default = _default;
+ /******/
-/***/ }),
-/* 12 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
+ __webpack_require__.d = function (exports, name, getter) {
+ /******/
+ if (!__webpack_require__.o(exports, name)) {
+ /******/
+ Object.defineProperty(exports, name, {
+ /******/
+ configurable: false,
+ /******/
+ enumerable: true,
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = void 0;
+ /******/
+ get: getter
+ /******/
-var _isFunction = _interopRequireDefault(__webpack_require__(24));
+ });
+ /******/
+ }
+ /******/
-var _isLength = _interopRequireDefault(__webpack_require__(30));
+ };
+ /******/
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ /******/
+ // getDefaultExport function for compatibility with non-harmony modules
-/**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
-function isArrayLike(value) {
- return value != null && (0, _isLength.default)(value.length) && !(0, _isFunction.default)(value);
-}
+ /******/
-var _default = isArrayLike;
-exports.default = _default;
-/***/ }),
-/* 13 */
-/***/ (function(module, exports, __webpack_require__) {
+ __webpack_require__.n = function (module) {
+ /******/
+ var getter = module && module.__esModule ?
+ /******/
+ function getDefault() {
+ return module['default'];
+ } :
+ /******/
+ function getModuleExports() {
+ return module;
+ };
+ /******/
-/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
+ __webpack_require__.d(getter, 'a', getter);
+ /******/
-var stylesInDom = {};
-var memoize = function (fn) {
- var memo;
+ return getter;
+ /******/
+ };
+ /******/
- return function () {
- if (typeof memo === "undefined") memo = fn.apply(this, arguments);
- return memo;
- };
-};
+ /******/
+ // Object.prototype.hasOwnProperty.call
-var isOldIE = memoize(function () {
- // Test for IE <= 9 as proposed by Browserhacks
- // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
- // Tests for existence of standard globals is to allow style-loader
- // to operate correctly into non-standard environments
- // @see https://github.com/webpack-contrib/style-loader/issues/177
- return window && document && document.all && !window.atob;
-});
+ /******/
-var getTarget = function (target) {
- return document.querySelector(target);
-};
-var getElement = (function (fn) {
- var memo = {};
+ __webpack_require__.o = function (object, property) {
+ return Object.prototype.hasOwnProperty.call(object, property);
+ };
+ /******/
- return function(target) {
- // If passing function in options, then use it for resolve "head" element.
- // Useful for Shadow Root style i.e
- // {
- // insertInto: function () { return document.querySelector("#foo").shadowRoot }
- // }
- if (typeof target === 'function') {
- return target();
- }
- if (typeof memo[target] === "undefined") {
- var styleTarget = getTarget.call(this, target);
- // Special case to return head of iframe instead of iframe itself
- if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
- try {
- // This will throw an exception if access to iframe is blocked
- // due to cross-origin restrictions
- styleTarget = styleTarget.contentDocument.head;
- } catch(e) {
- styleTarget = null;
- }
- }
- memo[target] = styleTarget;
- }
- return memo[target]
- };
-})();
+ /******/
+ // __webpack_public_path__
-var singleton = null;
-var singletonCounter = 0;
-var stylesInsertedAtTop = [];
+ /******/
-var fixUrls = __webpack_require__(122);
-module.exports = function(list, options) {
- if (typeof DEBUG !== "undefined" && DEBUG) {
- if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
- }
+ __webpack_require__.p = "";
+ /******/
- options = options || {};
+ /******/
+ // Load entry module and return exports
- options.attrs = typeof options.attrs === "object" ? options.attrs : {};
+ /******/
- // Force single-tag solution on IE6-9, which has a hard limit on the # of