Is it possible for the PHP configuration option “remember_state_upon_refresh” to prevent the columns’ visibility, order, and width from being reset? We definitely need the option to reset/clear filters, default ordering and paging, but I find it really annoying to reconfigure columns visibility, columns positioning, and width every time we refresh the page with this option set to false. What do you think? Do we need another (new) option for this? I’m currently using this workaround for clearing (but it renders/loads/blinks the table twice, far from optimal):
<script>
// workaround to clear filters and pagging when page loads (but do not clear column visibility, order, etc.)
// Maybe you must have 'publish_events' => true in the PHP config file
window.addEventListener('gcrud.datagrid.ready', () => {
setTimeout(function() {
document.querySelector(".grocery-crud .fa-eraser").click();
}, 300);
});
</script>
I am glad to inform you that we have a new configuration with name remember_filters_upon_refresh at the newer version 3.0.14 which if it is set as false it is not remembering the filters only.
Hi, Johnny! Unfortunately it didn’t work for me. I’m getting error “We can’t process the response of the server. Not well JSON formatted response.” only when the new remember_filters_upon_refresh is set to false. Could you assist me in debugging it more? The message that follows is not very useful…
<div class="grocery-crud" data-api-url="/admin/banners/plataforma" data-landing-page-url="/admin/banners/plataforma" data-theme="bootstrap-v5"data-unique-id="53951e598xxxx7db2c8fe27f1xxxxxx" data-remember-filtering="false" data-publish-events="true">
<div style="padding: 10px; border: 1px solid #aaa; border-radius: 10px;margin-bottom: 20px;display: none;" class="gc-hidden-message">
Ooooops, something went wrong! If you can see this message, this is probably a misconfiguration in Grocery CRUD Enterprise!
</div>
That’s weird. I will check it to see if there is a bug. In the meantime make sure that you have the configuration remember_filters_upon_refresh = false and make sure that you have remember_state_upon_refresh = true
Can you please ensure that you have both configurations and that the remember_state_upon_refresh is true ?
Also can you check from the network what error message you are getting?
I’m having a lot of difficulty debugging this situation. In my vanilla installation of GCE (for testing purposes) everything works normally. But in production, using a custom bootstrap theme, the error appears. Nothing in the logs… the only thing that appears different in the network tab is two 303 (xhr / Redirect) - in the middle - containg a strange (to me) payload:
Thank you for your detailed report. Unfortunately I still can’t reproduce the issue. Just to make sure, if you have the configuration remember_filters_upon_refresh to true nothing of the above happens? Very weird