Open Abhijeet501 opened 4 years ago
@Abhijeet501 This is known. Tabulator library renders footer as HTML without react binding. I suggest you render a React footer component outside of ReactTabulator. I'm open for PRs / suggestions.
The click event of the button works if I use plain tabulator and jsfiddle. It also works with react-tabulator, if I specify the footerElement as a string and use escaped strings inside it:
a) footerElement= {"<button onclick=\"alert('clicked')\">Click me</button>"}
With jsx syntax the button is shown but I did not get the event working:
b) footerElement= <button onClick={()=>alert('clicked')}>Click me</button>
As a workaround, I created a placeholder div in the footerElement and replace it with ReactDOM.render inside some event handler:
footerElement={"<div id='footer-element-placeholder'></div>"}
events={{
tableBuilt: function () {
self._createCustomFooter();
console.log("Table has been built");
},
}}
_createCustomFooter(){
let customFooter = <div>Custom footer</div>
let footerPlaceHolder = document.getElementById('footer-element-placeholder')
render(customFooter, footerPlaceHolder);
}
I also tried to use componentDidMount
. However, the placeholder element does not yet exist when componentDidMount
is called.
Title
Environment Details
Long Description No error just just the onclick donot work, nothing happens after I click the selectall button. any idea what am I missing thank you!
Workaround
...
(Please help with a PR if you have a solution. Thanks!)