To know about click event on image in custom formatter #863
-
I 'am trying to call a click event on image tag in custom formatter, But it didn't work as expected |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
because that's not the way to do it, you should always avoid adding any JS code in a Formatter because that is an open door to scripting attack (XSS). Funny enough you're not the only one thinking this way recently and it all came up recently because I closed that door in a recent SlickGrid PR #652 that will sanitize (remove) any JS code from a Formatter and other areas of SlickGrid and a few people got surprised as well. The correct way to do it in SlickGrid is by using any of the SlickGrid events that it exposes publicly, but an even easier way in Angular-Slickgrid is to use the column definition property onCellClicked that I added to the Column interface (it's a simple wrapper of the SlickGrid this.columnDefinitions = [{
id: 'firstName', /*....*/
onCellClick: (event, args) => {
const row, cell, dataView, columnDef, dataContext = args;
}
}]; I added 2 common event wrappers in the Column interface, |
Beta Was this translation helpful? Give feedback.
because that's not the way to do it, you should always avoid adding any JS code in a Formatter because that is an open door to scripting attack (XSS). Funny enough you're not the only one thinking this way recently and it all came up recently because I closed that door in a recent SlickGrid PR #652 that will sanitize (remove) any JS code from a Formatter and other areas of SlickGrid and a few people got surprised as well.
The correct way to do it in SlickGrid is by using any of the SlickGrid events that it exposes publicly, but an even easier way in Angular-Slickgrid is to use the column definition property onCellClicked that I added to the Column interface (it's a simple wrapper of the S…