Uncaught TypeError: onSort is not a function
react-bootstrap-table-next= ^1.4.0
Example: columns: [ { dataField: 'user.first_name', text: 'FirstName', sort: true } ]
Error: Uncaught TypeError: onSort is not a function
Please give me an example on codesandbox.io for reproducing, thanks
react-bootstrap-table-next= ^1.4.0
Example: columns: [ { dataField: 'user.first_name', text: 'FirstName', sort: true } ]
Error: Uncaught TypeError: onSort is not a function
@rikardocorp is this resolved. I'm also facing same issue
@rikardocorp I am also facing the same issue. columns = [{ dataField: 'name', text: 'Name', sort: true }, { dataField: 'role', text: 'Role', sort: true }] When I click to sort column
Uncaught TypeError: props.onSort is not a function
@AllenFang I may been able to reproduce the error. It seems when I store the columns in state is when I get problems with not being able to sort.
https://codesandbox.io/s/issue-652-vphgd
Curious why this got closed. It is a state thing. I am using hooks and had to set the headers at the beginning. I updated the headers (formatting with data coming in a load) and the sorting worked.
Having same issue - mine is being created only when part of columns comes from props - my current workaround (which is leading to tight coupling) is by hardcoding columns into the Table function
@amitsetty not even hardcoding the columns work for me :(
Same problem here on version 3.3.4
I have same problem because i put my data in state when it comes from api, and give it to table from state, like this.state.data, when i change to this.props.data it works grate
I have same problem because i put my data in state when it comes from api, and give it to table from state, like this.state.data, when i change to this.props.data it works grate
My data is also coming from props which passed from parent component, but it still doesnt work. Can you share your code?
@Grafomap there are same in my cod i pass props but in parent component take it from state. Can you give your code and we can try to solve it together
@fulin426 code example working only needed to change version ov module to latest
for mine to work, i updated the headers which caused my page to re-render. the sorting worked after that. i use hooks, so i just did setHeaders after my data loaded.
@dmuczynski-nexient can you share a snippet of that code with setHeaders? I don't know what you are talking about there xD
the hook: const [headers, setHeaders] = useState([]) in the useEffect (where i download the data), after i set the data, i just do this: setHeaders(updatedHeaders) updated headers includes the sort function and is dependent on the data being loaded first.