Skip to content

Commit

Permalink
examples for #426
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Apr 28, 2016
1 parent 0f2e6b7 commit 51bf5d0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
43 changes: 43 additions & 0 deletions examples/js/manipulation/custom-btn-text-table.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* eslint max-len: 0 */
/* eslint no-alert: 0 */
/* eslint guard-for-in: 0 */
import React from 'react';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';


const products = [];

function addProducts(quantity) {
const startId = products.length;
for (let i = 0; i < quantity; i++) {
const id = startId + i;
products.push({
id: id,
name: 'Item name ' + id,
price: 2100 + i
});
}
}

addProducts(5);

const options = {
exportCSVText: 'my_export',
insertText: 'my_insert',
deleteText: 'my_delete'
};

export default class InsertRowTable extends React.Component {
render() {
return (
<BootstrapTable data={ products } options={ options }
insertRow
deleteRow
exportCSV>
<TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn>
<TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn>
<TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn>
</BootstrapTable>
);
}
}
10 changes: 10 additions & 0 deletions examples/js/manipulation/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ExportCSVTable from './export-csv-table';
import DeleteRowCustomComfirmTable from './del-row-custom-confirm';
import SearchClearTable from './search-clear-table';
import DebounceSearchTable from './debounce-search-table';
import CustomButtonTextTable from './custom-btn-text-table';

class Demo extends React.Component {
render() {
Expand Down Expand Up @@ -92,6 +93,15 @@ class Demo extends React.Component {
</div>
</div>
</div>
<div className='col-md-offset-1 col-md-8'>
<div className='panel panel-default'>
<div className='panel-heading'>A Custom add/delete/exportcsv Button Text Example</div>
<div className='panel-body'>
<h5>Source in /examples/js/manipulation/custom-btn-text-table.js</h5>
<CustomButtonTextTable />
</div>
</div>
</div>
<div className='col-md-offset-1 col-md-8'>
<div className='panel panel-default'>
<div className='panel-heading'>Custom Confirmation for row deletion Example</div>
Expand Down

0 comments on commit 51bf5d0

Please sign in to comment.