4

I was thinking about making a simple component with a Select and the list of results that should be displayed.

After reading the code, that seems impossible, because if I change the url, then update is triggered by componentWillReceiveProps, and this method does not check for a change of perPage

Change the prop perPage of the List component does not work either because the List use this prop only if the query does not already contains perPage

Here is an example of what I want to do :

import { List } from "admin-on-rest";
class SourceList extends Component {
constructor(props) {
    super(props);
    this.state = {
        perPage: 10
    };
}

render() {
    return (
        <div>
            <Button
                onClick={() => {
                    this.setState({ perPage: 50 });
                }}
            />

            <List {...props} perPage={this.state.perPage}>
                ... Here would be the content of the list
            </List>
        </div>
    );
}
}
Flo
  • 71
  • 4
  • Simple code will tell us what was the exact problem. Please share the code with us, much easier to understand and let it for the others to think about it. – Jaccs Jul 13 '17 at 15:01
  • I added a code sample with what I want to do – Flo Jul 18 '17 at 11:36
  • how if you using redux ? cause redux can store the state globaly, so you can get the value even though you change the url – Rizal Sidik Jul 20 '17 at 04:03
  • No, this will not work, because the [AOR List component](https://github.com/marmelab/admin-on-rest/blob/master/src/mui/list/List.js#L90) will not refetch the datas if perPage parameter change – Flo Jul 20 '17 at 15:12

0 Answers0