diff --git a/BBjGridExWidget.bbj b/BBjGridExWidget.bbj index 8d92a387..a46a4bdb 100644 --- a/BBjGridExWidget.bbj +++ b/BBjGridExWidget.bbj @@ -146,7 +146,7 @@ class public BBjGridExWidget extends BBjWidget field private DataRow ColumnDefinition! - field private HashMap SelectedRows! = new HashMap() + field private HashMap SelectedRowsMap! = new HashMap() rem --------------------- constructors ------------------------------------- rem /** @@ -408,10 +408,10 @@ class public BBjGridExWidget extends BBjWidget if row!.getIsSelected() = 1 then selected!.add(row!) - #SelectedRows!.put(row!.getId(),row!) + #SelectedRowsMap!.put(row!.getId(),row!) else deselected!.add(row!) - #SelectedRows!.remove(row!.getId()) + #SelectedRowsMap!.remove(row!.getId()) fi wend @@ -996,23 +996,51 @@ rem --------------------api methods-------------------------------- rem /** rem * @return Hashmap with the selected row indexes and items rem */ - method public BBjVector getSelectedRows() - methodret #SelectedRows! + method public BBjVector getSelectedRowsInfo() + methodret #SelectedRowsMap! methodend rem /** rem * @return the selected row rem */ - method public BBjGridExWidgetRow getSelectedRow() + method public BBjGridExWidgetRow getSelectedRowInfo() - if #SelectedRows!.size() > 0 then - it! = #SelectedRows!.entrySet().iterator() + if #SelectedRowsMap!.size() > 0 then + it! = #SelectedRowsMap!.entrySet().iterator() methodret it!.next().getValue() fi methodret null() methodend + rem /** + rem * @return BBjVector with the selected row indexes and items + rem */ + method public BBjVector getSelectedRows() + declare BBjVector ids! + ids! = new BBjVector() + + it! = #SelectedRowsMap!.entrySet().iterator() + while it!.hasNext() + ids!.addItem(it!.next().getValue().getId()) + wend + methodret ids! + + methodend + + rem /** + rem * @return the selected row + rem */ + method public BBjNumber getSelectedRow() + + if #SelectedRowsMap!.size() > 0 then + it! = #SelectedRowsMap!.entrySet().iterator() + methodret num(it!.next().getValue().getId()) + fi + + methodret -1 + methodend + method public void setTheme(BBjString theme$) if pos(theme$="dark#fresh#blue#bootstrap#material")>0 then if info(3,6)="5" then diff --git a/Demo/SelectionDemo.bbj b/Demo/SelectionDemo.bbj index 35475a71..5addafbd 100644 --- a/Demo/SelectionDemo.bbj +++ b/Demo/SelectionDemo.bbj @@ -61,10 +61,12 @@ onRowSelect: ev! = BBjAPI().getLastEvent() ev! = ev!.getObject() print 'SHOW', ev!.getRowCount(), " ROW(s) AFFECTED By Event:" , ev!.getRows() - print 'SHOW', ev!.getSelectedRowCount()," ROW(S) SELECTED By Event: ",ev!.getSelectedIds() - print 'SHOW', ev!.getDeselectedRowCount()," ROW(S) DESELECTED By Event: ",ev!.getDeselectedIds() - print 'SHOW', grid!.getSelectedRows().size()," ROW(S) SELECTED SO FAR : ", grid!.getSelectedRows() - print 'SHOW', "------------------------------------------------------------------------" + print ev!.getSelectedRowCount()," ROW(S) SELECTED By Event: ",ev!.getSelectedIds() + print ev!.getDeselectedRowCount()," ROW(S) DESELECTED By Event: ",ev!.getDeselectedIds() + print 'BR',grid!.getSelectedRows().size()," GET SELECTED ROWS : ", grid!.getSelectedRows(),'ER' + print 'BR',grid!.getSelectedRows().size()," GET SELECTED ROW : ", grid!.getSelectedRow(),'ER' + + print "------------------------------------------------------------------------" return onRowDoubleclick: diff --git a/docs/javadoc/BBjGridExWidget.html b/docs/javadoc/BBjGridExWidget.html index 01e0ff5b..52bf32d6 100644 --- a/docs/javadoc/BBjGridExWidget.html +++ b/docs/javadoc/BBjGridExWidget.html @@ -2,9 +2,9 @@ - + BBjGridExWidget - + @@ -18,7 +18,7 @@ catch(err) { } //--> -var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":9,"i15":9,"i16":9,"i17":9,"i18":9,"i19":9,"i20":9,"i21":9,"i22":10,"i23":9,"i24":9,"i25":10,"i26":10,"i27":10,"i28":10,"i29":10,"i30":10,"i31":10,"i32":10,"i33":10,"i34":10,"i35":10,"i36":10,"i37":10,"i38":10,"i39":10,"i40":10,"i41":10,"i42":10,"i43":10,"i44":10,"i45":10,"i46":10,"i47":10,"i48":10,"i49":10,"i50":10,"i51":10,"i52":10,"i53":10,"i54":10,"i55":10,"i56":10,"i57":10}; +var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":9,"i17":9,"i18":9,"i19":9,"i20":9,"i21":9,"i22":9,"i23":9,"i24":10,"i25":9,"i26":9,"i27":10,"i28":10,"i29":10,"i30":10,"i31":10,"i32":10,"i33":10,"i34":10,"i35":10,"i36":10,"i37":10,"i38":10,"i39":10,"i40":10,"i41":10,"i42":10,"i43":10,"i44":10,"i45":10,"i46":10,"i47":10,"i48":10,"i49":10,"i50":10,"i51":10,"i52":10,"i53":10,"i54":10,"i55":10,"i56":10,"i57":10,"i58":10,"i59":10}; var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; @@ -227,247 +227,255 @@

Method Summary

-BBjGridExWidgetRow +BBjNumber getSelectedRow()  +BBjGridExWidgetRow +getSelectedRowInfo()  + + BBjVector getSelectedRows()  - + +BBjVector +getSelectedRowsInfo()  + + BBjVector getThemes()  - + static BBjNumber GRID_ALIGN_CENTER()  - + static BBjNumber GRID_ALIGN_LEFT()  - + static BBjNumber GRID_ALIGN_RIGHT()  - + static BBjString GRID_ROWPOS_BOTTOM()  - + static BBjString GRID_ROWPOS_MIDDLE()  - + static BBjString GRID_ROWPOS_TOP()  - + static BBjNumber GRID_SELECT_CELL()  - + static BBjNumber GRID_SELECT_ROW()  - + void moveColumn(BBjString Field$, BBjNumber toIndex!)  - + static BBjNumber ON_GRID_DOUBLE_CLICK()  - + static BBjNumber ON_GRID_SELECT_ROW()  - + void onLoad(BBjEvent ev!)
callback method after initial load does last initialization work
- + void onNativeEvent(BBjNativeJavaScriptEvent ev!)
Event Handler for Native JavaScript Event (from the Grid) Determines and dispatches the actual event
- + void pinColumn(BBjString Field$, BBjString pin$)
pin a column of the grid to the left or the right margin
- + void redraw(java.lang.Boolean f_init!)  - + void selectAll()
select all rows
- + void selectAll(BBjNumber x!)
select all rows
- + void setColumnAlignment(BBjString Field$, BBjNumber align)
set the alignment of a column
- + void setColumnBackColor(BBjString Field$, BBjColor color!)
set the background color of a column
- + void setColumnForeColor(BBjString Field$, BBjColor color!)
set the font color of a column
- + void setColumnState(BBjGridExWidgetColumnState state!)  - + void setColumnWidth(BBjString Field$, BBjNumber w!)
set the width of a column
- + void setData(DataTree tree!)
set the data into the grid, to create a tree grid
- + void setData(DataTree rs!, BBjString RowNodeId$)  - + void setData(DataTree rs!, BBjString RowNodeId$, BBjString ParentNodeId$)  - + void setData(ResultSet rs!)
set the data into the grid
- + void setData(ResultSet rs!, BBjString RowNodeId$)
set the data into the grid
- + void setEnableFilter(BBjNumber enable)
Allow filters in the grid
- + void setEnableFloatingFilter(BBjNumber enable)
Allow floating filters in the grid
- + void setFitToGrid(BBjNumber fit!)
set the grid to scroll horizontally or fit into the client area
- + void setGroupColumnLabel(BBjString label$)
set the label for the group column if the grid is a tree-grid defaults to "Group"
- + void setGroupSelectsChildren(BBjNumber x!)
When true, selecting a group will have the impact of selecting all its children When false, then the group is selectable independently of the child nodes
- + void setMultipleSelection(BBjNumber multiple)
Allow selection of multiple cells or rows
- + void setQuickFilter(BBjNumber filter)
Perform throw columns search
- + void setQuickFilter(BBjString filter!)
Perform throw columns search
- + void setSelectedRow(BBjNumber x!)
set the selected row
- + void setSelectedRows(BBjVector x!)
set the selected row indices
- + void setSelectionMode(BBjNumber mode)
set the selection mode of the grid
- + void setShowGroupChildCount(BBjNumber status!)
Optinally Suppress the number of items in a group
- + void setShowSelectionCheckbox(BBjNumber x!)
When true, selection box will be show on the first column When false, no checkbox will be displayed
- + void setTheme(BBjString theme$)  - + void setVisibleColumn(BBjString columnId!)
set visible column @@ -475,7 +483,7 @@

Method Summary

Ensures the column is visible, scrolling the table if needed.
- + void setVisibleRow(BBjNumber index!, BBjString position!) @@ -484,7 +492,7 @@

Method Summary

Ensures the row index is visible by vertically scrolling the grid. - + void showDeveloperConsole()
experimental function that shows the developer console @@ -1153,6 +1161,32 @@

setColumnState

public void setColumnState(BBjGridExWidgetColumnState state!)
+ + + + + + + + @@ -1162,7 +1196,7 @@

getSelectedRows

public BBjVector getSelectedRows()
Returns:
-
Hashmap with the selected row indexes and items
+
BBjVector with the selected row indexes and items
@@ -1172,7 +1206,7 @@

getSelectedRows