Skip to content

Commit

Permalink
feat: ✨ add BBjGridExWidget.ON_GRID_FILTER_CHANGED
Browse files Browse the repository at this point in the history
  • Loading branch information
hyyan committed Nov 20, 2020
1 parent f8db034 commit 58b1140
Show file tree
Hide file tree
Showing 8 changed files with 329 additions and 217 deletions.
73 changes: 46 additions & 27 deletions BBjGridExWidget.bbj
Expand Up @@ -208,14 +208,6 @@ class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterf
field protected BBjNumber newW!
field protected BBjNumber newH!
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 * A Constant value to define row selection (selected/deselected) change events
rem *
rem * @return BBjNumber
Expand Down Expand Up @@ -298,15 +290,6 @@ class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterf
methodret 5006
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 row editing stop event
rem *
rem * @return BBjNumber
Expand Down Expand Up @@ -339,6 +322,31 @@ class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterf
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 * Alias for <i>ON_GRID_STATE_CHANGE()</i>
rem *
rem * @see ON_GRID_STATE_CHANGE()
Expand Down Expand Up @@ -873,7 +881,6 @@ class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterf
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)
Expand Down Expand Up @@ -1088,7 +1095,6 @@ class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterf
map! = ev!.getEventMap()
type$ = str(map!.get("type"))
detail$ = str(map!.get("detail"))

switch type$
case "gw.rowSelect"
#onSelectRowChange(detail$, #ON_GRID_SELECT_ROW())
Expand Down Expand Up @@ -1138,6 +1144,9 @@ class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterf
case "gw.suggestion"
#onSuggestionEvent(detail$)
break
case "gw.filterChanged"
#onFilterChangedEvent()
break
swend
methodend
rem /**
Expand Down Expand Up @@ -2869,7 +2878,7 @@ class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterf
methodend
rem /**
rem * Sets the visibility of column(s)
rem *
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 */
Expand All @@ -2878,22 +2887,24 @@ class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterf
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
methodend
rem /**
rem * Sets the visibility of a column
rem *
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
methodend
rem /**
rem * Ensures the column is visible, scrolling the table if needed.
rem *
Expand Down Expand Up @@ -3799,7 +3810,7 @@ class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterf
rem *
rem * @param BBjString detail$ The event detail as Json
rem * @param BBjNumber type! The event type
rem *
rem *
rem * @see GxSelectRowEvent
rem */
method protected void onSelectRowChange(BBjString detail$, BBjNumber type!)
Expand All @@ -3808,17 +3819,18 @@ class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterf

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
fi

#fireEvent(type!,event!)
methodend
Expand Down Expand Up @@ -3853,7 +3865,6 @@ class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterf
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)
Expand Down Expand Up @@ -3923,5 +3934,13 @@ class public BBjGridExWidget extends BBjWidget implements GxColumnsManagerInterf
#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

classend

0 comments on commit 58b1140

Please sign in to comment.