datagrid
datagrid copied to clipboard
Problem with payload state and creating an URL in JS
Datagrid should use something different than state to create a URL in Javascript. The problem is that the state can mapped values. If I define filter in Nette Router, the state will contain these mapped values, not the ones which should be in the URL. In my case I'm converting id=123 into a object which is accessible in presenter as $this->id. The id is persistent. Nette Presenter will send the object, not the id (123). One option is to change the presenter to cenvert it back, but this is state, not url information.
Would it be good approach to send another payload from datagrid, which can be 'urlPrefix' and it will contain actual url, without datagrid component values. Datagrids JS will only add it's own parameters dependent on the action.
This is relevant only to the URL which is changed in the browser. It looks like everything is working until I refresh the page. In that case the persistent parameter which was filtered to object is lost.
I agree. Do you think you can send a PR?