Skip to content

Commit

Permalink
feat: implement focus method
Browse files Browse the repository at this point in the history
  • Loading branch information
hyyan committed Jul 12, 2019
1 parent 15a0fcb commit 6369d69
Show file tree
Hide file tree
Showing 6 changed files with 13,462 additions and 6 deletions.
51 changes: 51 additions & 0 deletions BBjGridExWidget.bbj
Expand Up @@ -2547,6 +2547,57 @@ class public BBjGridExWidget extends BBjWidget implements BBjGridExWidgetColumns
methodret v!
methodend
rem /**
rem * Set the focus on the given row id and the given column
rem *
rem * <br><b><small>#API</small></b>
rem * @param BBjString row! The row id
rem * @param BBjStrinf column! The column id
rem */
method public void focus(BBjString row! , BBjString column!)
#super!.focus()
script$="gw_setFocusedCell('" + #GRIDID$ + "','" + str(row!) + "','" + str(column!) + "');"
#executeScript(script$)
methodend
rem /**
rem * Set the focus on the given row id and the given column
rem *
rem * <br><b><small>#API</small></b>
rem *
rem * @param BBjNumber row! The row id
rem * @param BBjStrinf column! The column id
rem */
method public void focus(BBjNumber row! , BBjString column!)
#focus(str(row!) , column!)
methodend
rem /**
rem * Set the focus on the given row id and the first column
rem *
rem * <br><b><small>#API</small></b>
rem *
rem * @param BBjString row! The row id
rem */
method public void focus(BBjString row!)
#focus(str(row!) , "")
methodend
rem /**
rem * Set the focus on the given row id and the first column
rem *
rem * <br><b><small>#API</small></b>
rem *
rem * @param BBjNumber row! The row id
rem */
method public void focus(BBjNumber row!)
#focus(str(row!))
methodend
rem /**
rem * Will set the focus on the first cell of the first row
rem *
rem * <br><b><small>#API</small></b>
rem */
method public void focus()
#focus(0)
methodend
rem /**
rem * select all rows
rem *
rem * <br><b><small>#API</small></b>
Expand Down
12,711 changes: 12,708 additions & 3 deletions client/dist/bbj-grid-widget.js

Large diffs are not rendered by default.

684 changes: 682 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.

18 changes: 18 additions & 0 deletions client/src/api/cells.js
Expand Up @@ -55,3 +55,21 @@ export function gw_editPreviousCell(id) {
.api
.tabToPreviousCell();
}

/**
* Set Focus on the given row and column
*
* @param {String} id The grid's id
* @param {String|Number} row The row's index/id
* @param {String} column The column id
*/
export function gw_setFocusedCell(id, row, column) {
const options = gw_getGrid(id).options;
const r = !row ? 0 : (Number.isInteger(+row) ? +row : options.api.getRowNode(row).rowIndex);
const c = column ? column : options.columnApi.getAllGridColumns()[0].colId;
console.log(c,r)
gw_getGrid(id)
.options
.api
.setFocusedCell(r, c);
}
2 changes: 2 additions & 0 deletions client/webpack.config.js
Expand Up @@ -14,12 +14,14 @@ module.exports = {
"core-js/fn/string/starts-with.js",
"core-js/fn/array/for-each.js",
"core-js/fn/array/includes.js",
"core-js/fn/number/is-integer.js",
"./src/index.js"
],
"bbj-grid-widget": [
"core-js/fn/string/starts-with.js",
"core-js/fn/array/for-each.js",
"core-js/fn/array/includes.js",
"core-js/fn/number/is-integer.js",
"./src/index.js"
],
},
Expand Down

0 comments on commit 6369d69

Please sign in to comment.