Manuel Raaf
2017-07-17 14:22:41 UTC
Hi everybody,
I recently had the problem that f:widget:paginate created URIs that were way too long. The links contained every option of every <select> field and totaled up to some hundred, since the application simply needs lots of (short) values in the <select>s.
Nothing helped to solve the problem...then I occasionally read "How to dynamically create objects" in the sub-forum Extbase MVC and I recognized that the problem is about the "__trustedProperties" variable. I did not recognize it earlier since such long query strings are not good to read at all. I concentrated on fixing the problem within the viewhelper itself before.
Still I don't know why it takes all values - even if none was selected - and I define it as mind-numbing bug of the viewhelper -.-
I know that there is a reason for having "__trustedProperties" and that its name does not include "trusted" for fun, but when it comes to "delete your applicaion" vs. "fix it somehow!" you might want to disregard that, too.
The snippet below deletes "__trustedProperties" and its value inside pagination links. Ahead this string, there is the name of your controller roughly defined by .+? so that you don't have to explicitly name it on every page, and after there are the values that must end with & based on the must-have-format of valid query variables ([^&]+ reads until the next & occurs).
It is jQuery but easily can be written in native JS by using document.getElementsByClassName() etc.
$(".f3-widget-paginator").find("a").each(function(i,e) {
$(e).attr("href", $(e).attr("href").replace(/&.+?__trustedProperties[^&]+/, ''));
});
I hope this might help someone to save time and nerves on solving the same problem :)
Best wishes,
Manuel
I recently had the problem that f:widget:paginate created URIs that were way too long. The links contained every option of every <select> field and totaled up to some hundred, since the application simply needs lots of (short) values in the <select>s.
Nothing helped to solve the problem...then I occasionally read "How to dynamically create objects" in the sub-forum Extbase MVC and I recognized that the problem is about the "__trustedProperties" variable. I did not recognize it earlier since such long query strings are not good to read at all. I concentrated on fixing the problem within the viewhelper itself before.
Still I don't know why it takes all values - even if none was selected - and I define it as mind-numbing bug of the viewhelper -.-
I know that there is a reason for having "__trustedProperties" and that its name does not include "trusted" for fun, but when it comes to "delete your applicaion" vs. "fix it somehow!" you might want to disregard that, too.
The snippet below deletes "__trustedProperties" and its value inside pagination links. Ahead this string, there is the name of your controller roughly defined by .+? so that you don't have to explicitly name it on every page, and after there are the values that must end with & based on the must-have-format of valid query variables ([^&]+ reads until the next & occurs).
It is jQuery but easily can be written in native JS by using document.getElementsByClassName() etc.
$(".f3-widget-paginator").find("a").each(function(i,e) {
$(e).attr("href", $(e).attr("href").replace(/&.+?__trustedProperties[^&]+/, ''));
});
I hope this might help someone to save time and nerves on solving the same problem :)
Best wishes,
Manuel