Skip to content

Commit

Permalink
perf: reduce response sizes sent from the client
Browse files Browse the repository at this point in the history
  • Loading branch information
hyyan committed Jul 18, 2019
1 parent d25d5a9 commit e834e09
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 35 deletions.
2 changes: 1 addition & 1 deletion BBjGridExWidget.bbj
Expand Up @@ -3219,7 +3219,7 @@ class public BBjGridExWidget extends BBjWidget implements BBjGridExWidgetColumns
cell! = #getClientJsonFactory().getCell(parsedCell!)
event! = new BBjGridExWidgetClientEventsContextMenu()
event!.setCell(cell!)
#fireEvent(parsedCell!.get("id").getAsInt(),event!)
#fireEvent(parsedCell!.get("i").getAsInt(),event!)
methodend
rem /**
rem * On cell Event. handles cell clicking and editing events
Expand Down
20 changes: 10 additions & 10 deletions BBjGridExWidgetClientJsonFactory.bbj
Expand Up @@ -55,11 +55,11 @@ class public BBjGridExWidgetClientJsonFactory
declare BBjGridExWidgetClientRowModel row!

row! = new BBjGridExWidgetClientRowModel(#getWidget())
row!.setId(json!.get("id").getAsString(),err=*next)
row!.setChildIndex(json!.get("childIndex").getAsInt(),err=*next)
row!.setIndex(json!.get("index").getAsString(),err=*next)
row!.setParentKey(json!.get("parentKey").getAsString(),err=*next)
row!.setIsSelected(iff(json!.get("selected").getAsString() = "true" , 1 , 0) , err=*next)
row!.setId(json!.get("i").getAsString(),err=*next)
row!.setIndex(json!.get("x").getAsString(),err=*next)
row!.setChildIndex(json!.get("c").getAsInt(),err=*next)
row!.setParentKey(json!.get("p").getAsString(),err=*next)
row!.setIsSelected(iff(json!.get("s").getAsString() = "true" , 1 , 0) , err=*next)
methodret row!
methodend
rem /**
Expand Down Expand Up @@ -95,9 +95,9 @@ class public BBjGridExWidgetClientJsonFactory
rem */
method public BBjGridExWidgetClientCellModel getCell(JsonObject json!)
cell! = new BBjGridExWidgetClientCellModel()
cell!.setColumn(#getColumn(json!.get("column").getAsString()))
cell!.setRow(#getRow(json!.get("row").getAsJsonObject()))
cell!.setValue(json!.get("value").getAsString())
cell!.setColumn(#getColumn(json!.get("c").getAsString()))
cell!.setRow(#getRow(json!.get("r").getAsJsonObject()))
cell!.setValue(json!.get("v").getAsString())
methodret cell!
methodend
rem /**
Expand Down Expand Up @@ -125,14 +125,14 @@ class public BBjGridExWidgetClientJsonFactory
rem a model which describes the range object
rangeModel! = new BBjGridExWidgetClientRangeSelectionModel()
rem loop over the range columns and create a column model for each one
columns! = json!.get("columns").getAsJsonArray()
columns! = json!.get("c").getAsJsonArray()
columnsIterator! = columns!.iterator()
while(columnsIterator!.hasNext())
rem create a column model and add it to the range
rangeModel!.getColumns().add(#getColumn(columnsIterator!.next().getAsString()))
wend
rem loop over the range rows and create a row model for each one
rows! = json!.get("rows").getAsJsonArray()
rows! = json!.get("r").getAsJsonArray()
rowsIterator! = rows!.iterator()
while(rowsIterator!.hasNext())
rem create a row model and add it to the range
Expand Down
29 changes: 17 additions & 12 deletions client/dist/bbj-grid-widget.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions client/dist/bbj-grid-widget.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/src/api/menus.js
Expand Up @@ -24,7 +24,7 @@ export function gw_getContextMenu(gridId, params) {

gw_sendEvent(gw_getGrid(gridId).options.context, {
'type': 'gw.contextmenu',
'detail': JSON.stringify({ row: node, column: colId, value, id })
'detail': JSON.stringify({ r: node, c: colId, v:value, i:id })
}, id);
};
};
Expand Down
2 changes: 1 addition & 1 deletion client/src/api/rows.js
Expand Up @@ -260,7 +260,7 @@ export function gw_getRangeSelections(id) {
}

if (rows.length && columns.length) {
result.push({ rows, columns });
result.push({ r:rows, c:columns });
}
//}
});
Expand Down
12 changes: 6 additions & 6 deletions client/src/events/utilities.js
Expand Up @@ -73,12 +73,12 @@ export function gw_parseNode(node, context) {
node.data[context.getRowNodeId] : '';

return {
id: rowNodeId ? rowNodeId : node.id,
index: rowNodeId,
parentKey: node.hasOwnProperty('parent') && node.parent.hasOwnProperty('key') ?
node.parent.key : '',
childIndex: node.childIndex,
selected: Boolean(node.selected),
i: rowNodeId ? rowNodeId : node.id, // id
x: rowNodeId, // index
p: node.hasOwnProperty('parent') && node.parent.hasOwnProperty('key') ?
node.parent.key : '', // parent key
c: node.childIndex, //childIndex
s: Boolean(node.selected), // selected
};
}

Expand Down

0 comments on commit e834e09

Please sign in to comment.