Skip to content

Commit 37ce9ec

Browse files
authored
Merge pull request #28 from cynkra/fix-27-jserror
Fix #27
2 parents 0afbf72 + 9ba124e commit 37ce9ec

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

inst/htmlwidgets/cheetah.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

srcjs/widgets/cheetah.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,25 @@ HTMLWidgets.widget({
4444
// frozenColCount: 1,
4545
});
4646

47-
const {
48-
CLICK_CELL,
49-
CHANGED_VALUE,
50-
} = cheetahGrid.ListGrid.EVENT_TYPE;
51-
52-
grid.listen(
53-
CLICK_CELL, (...args) => {
54-
Shiny.setInputValue(`${id}_click_cell`, args);
55-
}
56-
);
57-
58-
grid.listen(
59-
CHANGED_VALUE, (...args) => {
60-
Shiny.setInputValue(`${id}_changed_value`, args);
61-
}
62-
);
47+
// Only is Shiny exists
48+
if (HTMLWidgets.shinyMode) {
49+
const {
50+
CLICK_CELL,
51+
CHANGED_VALUE,
52+
} = cheetahGrid.ListGrid.EVENT_TYPE;
53+
54+
grid.listen(
55+
CLICK_CELL, (...args) => {
56+
Shiny.setInputValue(`${id}_click_cell`, args);
57+
}
58+
);
59+
60+
grid.listen(
61+
CHANGED_VALUE, (...args) => {
62+
Shiny.setInputValue(`${id}_changed_value`, args);
63+
}
64+
);
65+
}
6366
},
6467

6568
resize: function (width, height) {

0 commit comments

Comments
 (0)