Skip to content

Commit

Permalink
Resolve issue #8 - implement setSelectedRow()
Browse files Browse the repository at this point in the history
  • Loading branch information
hyyan committed Jan 16, 2018
1 parent 159fbb5 commit 5d0f1d6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
30 changes: 30 additions & 0 deletions BBjGridExWidget.bbj
Expand Up @@ -114,6 +114,36 @@ class public BBjGridExWidget extends BBjWidget
#GroupChildCount=status!
methodend

rem /**
rem * set the selected row
rem */
method public void setSelectedRow(BBjNumber x!)

script$="bbj_grid_widget_set_selected_rows([" + str(x!) + "]);"
#executeScript(script$)
methodend

rem /**
rem * set the selected row indices
rem */
method public void setSelectedRows(BBjVector x!)

script$="bbj_grid_widget_set_selected_rows(["
it! = x!.iterator()
first=1
while it!.hasNext()
if first
first=0
else
script$=script$+","
fi
script$=script$+str(it!.next())
wend
script$=script$+"]);"

#executeScript(script$)
methodend

rem /**
rem * Event Handler for Native JavaScript Event (from the Grid)
rem * Determines and dispatches the actual event
Expand Down
10 changes: 10 additions & 0 deletions js/BBjGridExWidget.js
Expand Up @@ -131,6 +131,16 @@ function bbj_grid_widget_fit_grid(fitmode) {
$doc.bbj_grid_widget.api.sizeColumnsToFit();
}

function bbj_grid_widget_set_selected_rows(rows) {

console.log(rows);
$doc.bbj_grid_widget.api.forEachNode(function (node) {
if (rows.indexOf(node.rowIndex) > -1) {
node.setSelected( true );
}
}.bind(this));
}

function bbj_grid_widget_get_state() {

var state = $doc.bbj_grid_widget.columnApi.getColumnState();
Expand Down

0 comments on commit 5d0f1d6

Please sign in to comment.