Skip to content

Commit

Permalink
Enable to pass extra data for formatting cells
Browse files Browse the repository at this point in the history
  • Loading branch information
dana2208 committed Jan 28, 2016
1 parent 03f659b commit a4e4565
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class BootstrapTable extends React.Component {
align: column.props.dataAlign,
sort: column.props.dataSort,
format: column.props.dataFormat,
formatExtraData: column.props.formatExtraData,
filterFormatted: column.props.filterFormatted,
editable: column.props.editable,
hidden: column.props.hidden,
Expand Down
4 changes: 2 additions & 2 deletions src/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TableBody extends React.Component{
this.state.currEditCell.rid == r &&
this.state.currEditCell.cid == i){
var format=column.format?function(value){
return column.format(value,data).replace(/<.*?>/g,'');
return column.format(value, data, column.formatExtraData).replace(/<.*?>/g,'');
}:false;

return(
Expand All @@ -71,7 +71,7 @@ class TableBody extends React.Component{
var tdClassName=isFun(column.className)?column.className(fieldValue,data,r,i):column.className;

if(typeof column.format !== "undefined"){
var formattedValue = column.format(fieldValue, data);
var formattedValue = column.format(fieldValue, data, column.formatExtraData);
if (!React.isValidElement(formattedValue)) {
formattedValue = <div dangerouslySetInnerHTML={{__html: formattedValue}}></div>;
}
Expand Down

0 comments on commit a4e4565

Please sign in to comment.