Skip to content

Commit

Permalink
fix(JS): fix gw_parseNode is not defined when gw_getRangeSelections
Browse files Browse the repository at this point in the history
is called
  • Loading branch information
hyyan committed Jul 19, 2019
1 parent 36b2187 commit f25d5ae
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 36 deletions.
39 changes: 12 additions & 27 deletions client/dist/bbj-grid-widget.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 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.

23 changes: 17 additions & 6 deletions client/src/api/cells.js
Expand Up @@ -7,6 +7,7 @@
*/

import { gw_getGrid } from "./utilities";
import { gw_parseNode } from "events/utilities";

const { deepParseJson } = require("deep-parse-json");

Expand Down Expand Up @@ -129,24 +130,34 @@ export function gw_getRangeSelections(id) {
}

/**
* Add new cell range
* Parse the cells range in a format the grid can understand when it is passed
* to `api.addCellRange`
*
* @param {Number} id grid's id
* @param {Object} options The grid's options
* @param {Object} range bounded or unbounded range model
*/
export function gw_addCellRange(id, range) {
const options = gw_getGrid(id).options;
export function gw_parseAddCellRange(options , range) {
const pr = deepParseJson(JSON.stringify(range));
const start = !(pr.start || null) ?
0 : (Number.isInteger(+pr.start) ? +pr.start : options.api.getRowNode(pr.start).rowIndex);
const end = !(pr.end || null) ?
(options.rowData.length - 1) : (Number.isInteger(+pr.end) ? +pr.end : options.api.getRowNode(pr.end).rowIndex);

options.api.addCellRange({
return {
rowStartIndex: Math.abs(start),
rowEndIndex: Math.abs(end),
columns: pr.columns
});
};
}
/**
* Add new cell range
*
* @param {Number} id grid's id
* @param {Object} range bounded or unbounded range model
*/
export function gw_addCellRange(id, range) {
const options = gw_getGrid(id).options;
options.api.addCellRange(gw_parseAddCellRange(options, range));
}

/**
Expand Down

0 comments on commit f25d5ae

Please sign in to comment.