Skip to content

Commit

Permalink
feat: add support for tree data
Browse files Browse the repository at this point in the history
  • Loading branch information
hyyan committed Jul 8, 2019
1 parent 3a1cbe2 commit 9de7e29
Show file tree
Hide file tree
Showing 5 changed files with 13,343 additions and 7 deletions.
22 changes: 21 additions & 1 deletion BBjGridExWidget.bbj
Expand Up @@ -721,6 +721,22 @@ class public BBjGridExWidget extends BBjWidget implements BBjGridExWidgetColumns
rem */
field public BBjString OverlayNoRowsTemplate! = null()
rem /**
rem * Enable / Disable Tree Data mode
rem * <br><b><small>#Enterprise</small></b>
rem * <br><b><small>#Configuration</small></b>
rem * <br><b><small>#GridRerender</small></b>
rem */
field public BBjNumber TreeData! = null()
rem /**
rem * A string template which will be complied on the client to return an array
rem * for the tree hierarchy.
rem *
rem * <br><b><small>#Enterprise</small></b>
rem * <br><b><small>#Configuration</small></b>
rem * <br><b><small>#GridRerender</small></b>
rem */
field public BBjString DataPathTemplate! = null()
rem /**
rem * The grid languages manager
rem */
field protected BBjGridExWidgetLanguageManager LanguageManager! = new BBjGridExWidgetLanguageManager()
Expand Down Expand Up @@ -2012,7 +2028,7 @@ class public BBjGridExWidget extends BBjWidget implements BBjGridExWidgetColumns
rem Grouping & Pivoting
rem ===========================
options!.addProperty("groupUseEntireRow",#getGroupUseEntireRow().booleanValue() , err=*next)
options!.addProperty("groupDefaultExpanded",#getGroupDefaultExpanded().booleanValue() , err=*next)
options!.addProperty("groupDefaultExpanded",#getGroupDefaultExpanded().longValue(), err=*next)
options!. add("autoGroupColumnDef",#getAutoGroupColumnDefinition().getAsJsonObject(), err=*next)
options!.addProperty("groupMultiAutoColumn",#getGroupMultiAutoColumn().booleanValue() , err=*next)
options!.addProperty("groupSuppressRow",#getGroupSuppressRow().booleanValue() , err=*next)
Expand Down Expand Up @@ -2055,6 +2071,9 @@ class public BBjGridExWidget extends BBjWidget implements BBjGridExWidgetColumns
options!.addProperty("suppressNoRowsOverlay",#getSuppressNoRowsOverlay().booleanValue(), err=*next)
options!.addProperty("overlayLoadingTemplate",#getOverlayLoadingTemplate(), err=*next)
options!.addProperty("overlayNoRowsTemplate",#getOverlayNoRowsTemplate(), err=*next)
rem Tree Data
rem ===========================
options!.addProperty("treeData",#getTreeData().booleanValue(), err=*next)
rem Miscellaneous
rem ===========================
options!.addProperty("suppressMiddleClickScrolls",#getSuppressMiddleClickScrolls().booleanValue() , err=*next)
Expand Down Expand Up @@ -2082,6 +2101,7 @@ class public BBjGridExWidget extends BBjWidget implements BBjGridExWidgetColumns
context!.addProperty("showHeaderSelectionCheckbox",#ShowHeaderSelectionCheckbox!, err=*next)
context!.addProperty("contextMenu",#ContextMenu!.toString(), err=*next)
context!.addProperty("navigateToNextCell",Iff(#NavigationBehavior! = #GRID_NAVIGATION_BEHAVIOUR_NEXT_ROW() , 1 , 0), err=*next)
context!.addProperty("getDataPath",#getDataPathTemplate(), err=*next)
options!.add("context",context!)
methodret options!
methodend
Expand Down
12,648 changes: 12,645 additions & 3 deletions client/dist/bbj-grid-widget.js

Large diffs are not rendered by default.

672 changes: 670 additions & 2 deletions client/dist/bbj-grid-widget.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/report.html

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions client/src/api/init.js
Expand Up @@ -67,6 +67,7 @@ export function gw_init(options, license , data) {
function gw_parseOptions(options) {
const deepParsedOptions = deepParseJson(JSON.stringify(options));
const id = deepParsedOptions.context.id;
const getDataPathTemplate = deepParsedOptions.context.getDataPath || "";
// TODO: do we need to control this setting from BBj ?
const debounceDuration = 250;
const finalOptions = {
Expand Down Expand Up @@ -111,6 +112,11 @@ function gw_parseOptions(options) {
finalOptions.navigateToNextCell = params => { return gw_navigateToNextRow(id, params) };
}

if (getDataPathTemplate && finalOptions.treeData) {
const getDataPathTemplateComplied = template(getDataPathTemplate);
finalOptions.getDataPath = data => getDataPathTemplateComplied({ data: data });
}

// extend the column definitions
gw_extendColumnDefinitions(finalOptions.columnDefs);

Expand Down

0 comments on commit 9de7e29

Please sign in to comment.