Skip to content

Footer #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import React, { Component, PropTypes } from 'react';
import Const from './Const';
import TableHeader from './TableHeader';
import TableFooter from './TableFooter';
import TableBody from './TableBody';
import PaginationList from './pagination/PaginationList';
import ToolBar from './toolbar/ToolBar';
Expand Down Expand Up @@ -291,6 +292,23 @@ class BootstrapTable extends Component {
onRowMouseOut={ this.handleRowMouseOut }
onSelectRow={ this.handleSelectRow }
noDataText={ this.props.options.noDataText } />
<TableFooter
ref='footer'
tableHeaderClass={ this.props.tableHeaderClass }
style={ this.props.headerStyle }
rowSelectType={ this.props.selectRow.mode }
hideSelectColumn={ this.props.selectRow.hideSelectColumn }
sortName={ sortInfo ? sortInfo.sortField : undefined }
sortOrder={ sortInfo ? sortInfo.order : undefined }
sortIndicator={ sortIndicator }
onSort={ this.handleSort }
onSelectAllRow={ this.handleSelectAllRow }
bordered={ this.props.bordered }
condensed={ this.props.condensed }
isFiltered={ this.filter ? true : false }
isSelectAll={ isSelectAll }>
{ this.props.children }
</TableFooter>
</div>
{ tableFilter }
{ pagination }
Expand Down
46 changes: 46 additions & 0 deletions src/TableFooter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React, { Component, PropTypes } from 'react';
import classSet from 'classnames';

class TableHeader extends Component {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If its a tablefooter than class name should be TableFooter rather than TableHeader


render() {
const containerClasses = classSet('react-bs-container-header', 'table-header-wrapper');
const tableClasses = classSet('table', 'table-hover', {
'table-bordered': this.props.bordered,
'table-condensed': this.props.condensed
}, this.props.tableHeaderClass);
return (
<div ref='container' className={ containerClasses } style={ this.props.style }>
<table className={ tableClasses }>
<tfoot>
<tr ref='footer'>
{
this.props.children.map( child => {
console.log('child ', child);
return <td>{ child.props.footer || child.props.children }</td>;
})
}
</tr>
</tfoot>
</table>
</div>
);
}
}
TableHeader.propTypes = {
tableHeaderClass: PropTypes.string,
style: PropTypes.object,
rowSelectType: PropTypes.string,
onSort: PropTypes.func,
onSelectAllRow: PropTypes.func,
sortName: PropTypes.string,
sortOrder: PropTypes.string,
hideSelectColumn: PropTypes.bool,
bordered: PropTypes.bool,
condensed: PropTypes.bool,
isFiltered: PropTypes.bool,
isSelectAll: PropTypes.oneOf([ true, 'indeterminate', false ]),
sortIndicator: PropTypes.bool
};

export default TableHeader;