Skip to content
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

MultipleSearch throws javascript error when prototype.js present #50

Closed
kpturner opened this issue Jun 18, 2010 · 6 comments
Closed

MultipleSearch throws javascript error when prototype.js present #50

kpturner opened this issue Jun 18, 2010 · 6 comments

Comments

@kpturner
Copy link

I have an application with used both prototype.js and jquery. I have"$j = jQuery.noConflict();" to prevent any conflicts. All aspects of jQuery and jqGrid work perfectly with one notable exception. If you bring up the multiplesearch dialog and click "find" or "reset" an error is thrown:
"this._each is not a function" on line 617 of prototype.js version 1.6.0.3 on line 617.

So somehow we have managed to get diverted into the prototype.js code while processing the reset or find functionality.

I have installed jqGrid version 3.7.1 because it mentions fixes for compatibility with other JS libs but sadly this problem persists. I would like to remove prototype.js but at the moment it is not practical since there is far too much code still relying on it.

Hopefully you would be able to repeat this error just by including prototype.js and using the "noConflict" function as I have done.

@tonytomov
Copy link
Owner

Hello,
Thanks for finding this. Also I have made some changes in serachFilter.
Could you please test the last fix from here. Please let me know if this resolves the issue.
Best Regards
Tony

@kpturner
Copy link
Author

OK I think I have picked up the change, but I am still getting the error. In fact it is a little worse because before it did actually issue the xmlhttprequest when I pressed "Find" even though it threw the javascript error. Now it is still throwing the error but no request is being submitted. Can you point me at the line of code that changed so I can be sure I have the correct version. It says v1.2.9 at the top.

@kpturner
Copy link
Author

Ahh, I found the change:
$(selDOMobj).change();
changed to
jQuery(selDOMobj).change();

I have ensured that is in place and my last post is now inaccurate. The "Find" button does submit the request and no errors are thrown. However, the previously reported error is still thrown if you click the "Reset" button or if you click the plus or minus to add/remove search criteria. I guess, therefore, a similar fix is required elsewhere?

@kpturner
Copy link
Author

Not sure if this helps, put the error is thrown on the mouseover and click events for the "div.ui-add" element - seemingly when it does "newrow.find("select[name='field']").change();"
Haven't checked what happens on the reset and minus (delete) buttons yet but I am guess it is a similar problem.

@tonytomov
Copy link
Owner

Hello,
The problem is in jQuery 1.4.2 and the new bubbling feature in on change event
http://api.jquery.com/change/

Also there are a lot of other changes maybe.
I have just reproduced this and can confirm that there is a problem. You will not have problems if you switch to jQuery 1.3.2.
I have made some additional changes,
http://github.com/tonytomov/jqGrid/commit/7838f2903dd0802610277d1b42ac3837f189a7fe#diff-1
but they do not fix the problem. After the first adding everything is ok, but when we try to hover the add or del buttons the error apper.

Also the error appear when we try to change the field name.
Too many problems, so I will not try to correct this problem, since maybe it will destroy the existing functionality - Sorry.

Thanks again
Best Regards
Tony

@kpturner
Copy link
Author

Thanks for confirming the problem. I have had to bite the bullet and spent yesterday removing all trace of prototype.js from our application (I have retained useful stuff like Class.create() but eradicated the stuff causing the conflict). Most of it consisted of painstaking find/replace :-) This did highlight another problem when Rico.js is present. This extends Array and I found that after the serializeGridData event I had piles of unwanted junk appended to the ajax request postData. Although I was able to parse this out in my own function in serializeGridData I did a dboule fix and removed the Rico array extension functions lso (not needed for us).

Thanks

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants