Multiple buttons in one cell with onClick for each #1048
Unanswered
MajdalHyder
asked this question in
Q&A
Replies: 1 comment
-
Hello, columns: ['Cédula', 'Nombre', 'Partido', {
name: 'Opciones',
attributes: {
'title': 'Eliminar concejal'
},
formatter: (cell, row) => {
const btns = []
btns[0] = h('a', {
className: 'btn btn-danger btn-sm',
onClick: () => this.deleteElement(`${row.cells[3].data}`,`${row.cells[1].data}`,`${row.cells[0].data}`)
}, html('<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M8 9h8v10H8z" opacity=".3"/><path d="M15.5 4l-1-1h-5l-1 1H5v2h14V4zM6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM8 9h8v10H8V9z" fill="currentColor"/></svg>'))
btns[1] = h('a', {
className: 'btn btn-primary btn-sm',
onClick: () => this.editElement(`${row.cells[2].data}`,`${row.cells[1].data}`,`${row.cells[0].data}`)
}, html('<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M5 18.08V19h.92l9.06-9.06-.92-.92z" opacity=".3"/><path d="M20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29s-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83zM3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM5.92 19H5v-.92l9.06-9.06.92.92L5.92 19z" fill="currentColor"/></svg>'))
return btns
}
}] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
In gridjs-react, I want to add two buttons in one cell each with it's own oncClick function,
but it's not working, i tried using "_" and "html".
"_" is not working at all
"html" is not accepting functions declared in my react component, could you please help me with a demo of how to do this please,
thank you
Beta Was this translation helpful? Give feedback.
All reactions