Closed Styvak closed 7 years ago
Hello!
It should be possible, according to https://github.com/Imballinst/react-bs-datatable/blob/master/src/index.js#L179
if (React.isValidElement(columnValue)) {
// If columnValue is React element
columnValue = this.getLastChildren(columnValue);
} else if (typeof columnValue === 'number') {
// If columnValue is a number
columnValue = columnValue.toString();
}
// Lowercase columnValue
columnValue = columnValue.toLowerCase();
// If filterable and columnValue contains filterText
if (this.isPropFilterable(elementProps[i]) &&
_includes(columnValue, this.state.filterText.toLowerCase())) {
isElementIncluded = true;
}
When you have an HTML object, the table will get the last children of it, say:
<a href="#someLink">
<span className="span-class">
<b>
Text
</b>
</span>
</a>
In this case, the .getLastChildren()
should return the "Text" string, just like the example on https://imballinst.github.io/react-bs-datatable/. Would you like to tell me the HTML object you are trying to display so I can try reproduce it? Thanks.
It works thanks ! I just have to add a text at last children
You're welcome! My pleasure to help :)
Thanks for reporting this, too, I realized some points that I missed when I made the filterData()
function (will fix next version):
.isPropFilterable()
at the beginning of the loop instead of at the end, so your case when filterable
is set to false
already but still outputs an error won't happen
I have a property with an html button to link to and other url, on the header filterable is false but when I use the search I have an error : Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
It is possible to display an html object with the database ?
Thanks