React-bootstrap-table2: Warning: Failed prop type: Invalid prop `page` of type `object` supplied to `SizePerPageOption`, expected `number`

Created on 11 Aug 2018  路  5Comments  路  Source: react-bootstrap-table/react-bootstrap-table2

I defined a sizePerPageList with objects containing text and value keys. I get the following warning. Why?

Warning: Failed prop type: Invalid prop page of type object supplied to SizePerPageOption, expected number

Most helpful comment

when products.length=0 show same message error: Failed prop type: Invalid prop page of type object supplied to SizePerPageOption, expected number.

All 5 comments

@ipflowss I guess your value property is an object, it should be a number:

sizePerPageList: [{
    text: '5', value: 5
  }, {
    text: '10', value: 10
  }, {
    text: 'All', value: products.length
  }] 

Please reopen this issue if the problem still remain, thank you

when products.length=0 show same message error: Failed prop type: Invalid prop page of type object supplied to SizePerPageOption, expected number.

This problem still exists in the react-bootstra-table-2

This is my code and I am still getting the same warning. tableData length is always more than zero.

var tableData =[]
if(this.props.data!=null){
tableData = this.props.data
}
sizePerPageList: [{
text: '5', value: 5
}, {
text: '10', value: 10
},
{
text: 'All', value: tableData.length
}]

getting following warning

Failed prop type: Invalid prop sizePerPage of type object supplied to PaginationList, expected number.
code like -
this.options = {
sizePerPage: 20,
sizePerPageList: [
{
text: '10', value: 10
},
{
text: '20', value: 20
},
{
text: '50', value: 50
},
{
text: 'All', value:0
}
]
};
this.options.sizePerPageList[3].value = (this.props.data)?this.props.data.length:0;

data will be type of Array always.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

josefheld picture josefheld  路  3Comments

dillobird picture dillobird  路  3Comments

Randore picture Randore  路  3Comments

kamarajuPrathi picture kamarajuPrathi  路  4Comments

cnav007 picture cnav007  路  4Comments