-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yiiGridView pagination stops working on ajax request #4570
Comments
The temporary solution is to revert back to package 1.1.29. |
@kevin-foster-uk It seems #4563 has caused a regression, could you take a look at this? @Skalin Could you point out exactly where you think the update jquery-bbq has caused this? I don't see it in your stack trace. |
Well the javascripts throws the error on the: "qs.hasOwnProperty" method call inside the ajaxPreFilter method. I believe that the bbq library expects the deparam function to return object. I tried logging it from console and it returns the object, but somehow it does not have the methods of the object prototype. Theoretically, rewriting the call "qs.hasOwnProperty("ajax")" to "Object.prototype.hasOwnProperty.call(qs, 'ajax')" should work. But I am not sure whether the issue would occur anywhere else. |
@Skalin Can I ask what browser you are using? This update removed support for old IE browsers (edge is still supported). In my testing using chrome, the ajax pagination is working fine. |
🤴 |
Sorry for a bit of false alarm guys. :) The issue happens in the Bootstrap extension ( This can be fixed by updating the bootstrap extension, nevertheless I think that the proper fix should be that the deparam.querystring from bbq library returns a standard Object. What do you think? |
@Skalin The docblock above the function states it should return an object: https://github.com/LimeSurvey/yii/blob/ae2af5c65bb12dbd99cf0d69fdbaa4cc0b5f0ee1/framework/web/js/source/jquery.ba-bbq.js#L472 Can you post a full stack trace from your browsers inspector with clear input and output from the |
Hi, I am sending the whole trace that I got. Input and ouptut of deparam.querystring method:
Calling then the following method result in an exception:
Error trace of the method (I am sorry, Yii has already the minified version and I was not able to make it use the non-minified version):
I think that this all comes to jquery.ba-bbq.js, where the object is being created with "null" as param:
Creating object this way results in missing methods like hasOwnProperty.
Is this enough information? |
Reading the diagnosis and code again, the method still always returns object in the final line, consistent with the docblock. But Stalin is correct, what changed is that object no longer contains prototype methods: @kevin-foster-uk When you create an object with |
@marcovtwout The I will create a new PR to fix the issue. |
@kevin-foster-uk I would suggest to first push this upstream cowboy/jquery-bbq#62 / cowboy/jquery-bbq#61, that way more eyes can look at the security fix. @Skalin Regardless of this fix, I suggest to submit a PR to https://github.com/clevertech/YiiBooster as well. Looking at that code, it doesn't really need "hasOwnProperty" but could just do |
A PR has been created: #4571 |
The pagination and or filtration of grid views stops working upon trying to filter using Ajax request. This is caused by an updated jquery-bbq library. The library fails in "qs.HasOwnProperty" method.
What steps will reproduce the problem?
Trying to refresh, paginate or filter the Yii gridview causes javascript to fail. This is done even before any AJAX request is done.
Simple call for: $("#grid-view").yiiGridView("update", {url: refreshURL}); will cause the bug.
What is the expected result?
The grid view is properly updated and the ajax request is processed.
What do you get instead?
Error response:
More info - the issue occurs in the function ajax.preFilter:
Additional info
The text was updated successfully, but these errors were encountered: