-
Notifications
You must be signed in to change notification settings - Fork 782
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/AllenFang/react-bootstrap…
- Loading branch information
Showing
9 changed files
with
199 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict'; | ||
import React from 'react'; | ||
import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table'; | ||
|
||
|
||
var products = []; | ||
|
||
function addProducts(quantity) { | ||
var startId = products.length; | ||
for (var i = 0; i < quantity; i++) { | ||
var id = startId + i; | ||
products.push({ | ||
id: id, | ||
name: "Item name " + id, | ||
price: 2100 + i | ||
}); | ||
} | ||
} | ||
|
||
addProducts(5); | ||
|
||
function afterSearch(searchText, result){ | ||
console.log('Your search text is ' + searchText); | ||
console.log('Result is:'); | ||
for(let i=0;i<result.length;i++){ | ||
console.log("Product: " + result[i].id + ", " + result[i].name + ", " + result[i].price); | ||
} | ||
} | ||
|
||
var options = { | ||
afterSearch: afterSearch, //define a after search hook, | ||
clearSearch: true | ||
} | ||
|
||
export default class SearchClearTable extends React.Component{ | ||
render(){ | ||
return ( | ||
<BootstrapTable data={products} search={true} options={options}> | ||
<TableHeaderColumn dataField="id" isKey={true}>Product ID</TableHeaderColumn> | ||
<TableHeaderColumn dataField="name">Product Name</TableHeaderColumn> | ||
<TableHeaderColumn dataField="price">Product Price</TableHeaderColumn> | ||
</BootstrapTable> | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters