Describe the bug
Setting columns hidden and hiddenByColumnsButton to "true" cause an "type undefined error" when unhiding the column.
Thrown Error:
Uncaught TypeError: Cannot read property 'match' of undefined
Where the Error was thrown:
var reducePercentsInCalc = function reducePercentsInCalc(calc, fullValue) {
var captureGroups = calc.match(/(\d*)%/);
if (captureGroups && captureGroups.length > 1) {
var percentage = captureGroups[1];
return calc.replace(/\d*%/, "".concat(fullValue * (percentage / 100), "px"));
}
return calc.replace(/\d*%/, "".concat(fullValue, "px"));
};
To Reproduce
Steps to reproduce the behavior:
columns = {
{ Title: 'some_title',field: 'some_field', hidden:true,hiddenByColumnsButton:true}
}
options = {columnsButton:true}Expected behavior
It will show the hidden column
Desktop (please complete the following information):
Additional context
What am I am trying to achieve is hide un necessary columns after render to de-clutter the table.
From searching I found some PR but is still pending. Is there any alternative workaround? Please help.
Found a solution:
if calc is not truthy the function will return fullValue.
I will be creating a PR later.
Same issue here, waiting for the PR from @nivranaitsirhc . Do you know exactly when this bug was introduced? Which version were you pointing at?
Update: I just checked and it stops working in version 1.65.0
This might not be fixed instantly.
I am not going to close this issue here, but we have implemented this fix over at @material-table We are a fork of material-table and we plan on pushing the changes up to material-table when we can. (only mbrn can update material-table.
Most helpful comment
Found a solution:
if
calcis not truthy the function will return fullValue.I will be creating a PR later.