mirror of
https://github.com/gosticks/react-table.git
synced 2026-06-28 17:10:01 +00:00
Pass standard linting
This commit is contained in:
@@ -23,7 +23,7 @@ export default {
|
||||
defaultSorting: [],
|
||||
showFilters: false,
|
||||
defaultFiltering: [],
|
||||
defaultFilterMethod: (filter, row, column) => (row[filter.id] == filter.value),
|
||||
defaultFilterMethod: (filter, row, column) => (row[filter.id] === filter.value),
|
||||
|
||||
// Controlled State Overrides
|
||||
// page: undefined,
|
||||
|
||||
@@ -416,7 +416,7 @@ export default React.createClass({
|
||||
const pivotCols = []
|
||||
for (let i = 0; i < column.pivotColumns.length; i++) {
|
||||
const col = column.pivotColumns[i]
|
||||
const filter = filtering.find(filter => filter.id == col.id)
|
||||
const filter = filtering.find(filter => filter.id === col.id)
|
||||
pivotCols.push(
|
||||
<span key={col.id}
|
||||
style={{display: 'flex', alignContent: 'flex-end', flex: 1}}>
|
||||
@@ -474,7 +474,7 @@ export default React.createClass({
|
||||
)
|
||||
}
|
||||
|
||||
const filter = filtering.find(filter => filter.id == column.id)
|
||||
const filter = filtering.find(filter => filter.id === column.id)
|
||||
|
||||
return (
|
||||
<ThComponent
|
||||
|
||||
@@ -262,7 +262,7 @@ export default {
|
||||
(filteredSoFar, nextFilter) => {
|
||||
return filteredSoFar.filter(
|
||||
(row) => {
|
||||
const column = allVisibleColumns.find(x => x.id == nextFilter.id) || {}
|
||||
const column = allVisibleColumns.find(x => x.id === nextFilter.id) || {}
|
||||
const filterMethod = column.filterMethod || defaultFilterMethod
|
||||
return filterMethod(nextFilter, row, column)
|
||||
})
|
||||
@@ -428,9 +428,9 @@ export default {
|
||||
}
|
||||
|
||||
// Remove old filter first if it exists
|
||||
const newFiltering = (filtering || []).filter(x => x.id != column.id)
|
||||
const newFiltering = (filtering || []).filter(x => x.id !== column.id)
|
||||
|
||||
if (event.target.value != '') {
|
||||
if (event.target.value !== '') {
|
||||
newFiltering.push({
|
||||
id: column.id,
|
||||
value: event.target.value
|
||||
|
||||
@@ -18,13 +18,13 @@ const requestData = (pageSize, page, sorting, filtering) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// On the server, you'll likely use SQL or noSQL or some other query language to do this.
|
||||
// For this mock, we'll just use lodash
|
||||
let filteredData = rawData;
|
||||
let filteredData = rawData
|
||||
if (filtering.length) {
|
||||
filteredData = filtering.reduce(
|
||||
(filteredSoFar, nextFilter) => {
|
||||
return filteredSoFar.filter(
|
||||
(row) => {
|
||||
return (row[nextFilter.id]+"").includes(nextFilter.value)
|
||||
return (row[nextFilter.id] + '').includes(nextFilter.value)
|
||||
})
|
||||
}
|
||||
, filteredData)
|
||||
@@ -93,7 +93,7 @@ const ServerSide = React.createClass({
|
||||
}]}
|
||||
manual // Forces table not to paginate or sort automatically, so we can handle it server-side
|
||||
defaultPageSize={10}
|
||||
showFilters={true}
|
||||
showFilters
|
||||
data={this.state.data} // Set the rows to be displayed
|
||||
pages={this.state.pages} // Display the total number of pages
|
||||
loading={this.state.loading} // Display the loading overlay when we need it
|
||||
|
||||
Reference in New Issue
Block a user