From a4e4565a872a5f188d117b5fc01e767b4d0e03ef Mon Sep 17 00:00:00 2001 From: dana2208 Date: Thu, 28 Jan 2016 14:25:19 +0200 Subject: [PATCH] Enable to pass extra data for formatting cells --- src/BootstrapTable.js | 1 + src/TableBody.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/BootstrapTable.js b/src/BootstrapTable.js index fb76faf02..c09f2bea5 100644 --- a/src/BootstrapTable.js +++ b/src/BootstrapTable.js @@ -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, diff --git a/src/TableBody.js b/src/TableBody.js index 6059c8ea4..ea402959a 100644 --- a/src/TableBody.js +++ b/src/TableBody.js @@ -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( @@ -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 =
; }