I enabled apachesolr_autocomplete 7.x-1.5.. it is blocking the remaining jquery. No jquery is working after enabling this module. The firebug console shows the following error "TypeError: jQuery(...).autocomplete(...).addClass(...).data(...) is undefined----.data('autocomplete')._renderItem = Drupal.apachesolr_autocomplete.renderItem". I can't use this module. I can't use this module.

Comments

ursramesh created an issue. See original summary.

ursramesh’s picture

Issue summary: View changes

I enabled apachesolr_autocomplete 7.x-1.5.. it is blocking the remaining jquery. No jquery is working after enabling this module. The firebug console shows the following error "TypeError: jQuery(...).autocomplete(...).addClass(...).data(...) is undefined----.data('autocomplete')._renderItem = Drupal.apachesolr_autocomplete.renderItem". I can't use this module. I can't use this module.

nico.knaepen’s picture

Status: Needs work » Needs review
StatusFileSize
new1.76 KB
nico.knaepen’s picture

Issue is solved in latest dev release.

jacov’s picture

confirmed, i ran into this and hack / patched it with the following code:

diff --git a/docroot/sites/all/modules/apachesolr_autocomplete/apachesolr_autocomplete_jqueryui.js b/docroot/sites/all/modules/apachesolr_autocomplete/apachesolr_autocomplete_j
index db41d8a..b252485 100644
--- a/docroot/sites/all/modules/apachesolr_autocomplete/apachesolr_autocomplete_jqueryui.js
+++ b/docroot/sites/all/modules/apachesolr_autocomplete/apachesolr_autocomplete_jqueryui.js
@@ -35,7 +35,7 @@ Drupal.apachesolr_autocomplete = {
         delay: 400
     })
     .addClass('form-autocomplete')
-    .data('autocomplete')._renderItem = Drupal.apachesolr_autocomplete.renderItem
+    .data('ui-autocomplete')._renderItem = Drupal.apachesolr_autocomplete.renderItem
     ;
   },
     // TODO: USe JS-side theming. See http://engineeredweb.com/blog/11/5/javascript-theme-functions-drupal/

i will download the dev version. thanks

jacov’s picture

Version: 7.x-1.5 » 7.x-1.x-dev
StatusFileSize
new81.94 KB
new51.17 KB
new54.78 KB
new610 bytes

confirmed,
i ran into the same issue and have verified that running version 1.5 does indeed have a js error in the console.

i applied the above patch from comment #3, and confirmed the js error was gone, but the autocomplete still rendered the html...see next screenshot...

s3

so i took a different approach to the patch, and confirmed that this patch fixes both the js console error as well as the html escaping / rendering autocomplete issue.

s1

attached my patch (also relative to the module root)

nico.knaepen’s picture

Status: Needs review » Reviewed & tested by the community
janusman’s picture

Status: Reviewed & tested by the community » Needs work

So, actually...

I applied the patch to a *stock* Drupal 7.41 install (where we are using Jquery UI 1.8.7, along with the core Bartik theme), and the current apachesolr_autocomplete-7.x-1.x (without patch) works fine, where if I add the patch I get the behavior you report as the problem and your patch supposedly fixes.

Doing some research I found this post:

http://stackoverflow.com/questions/9513251/cannot-set-property-renderite...

Certain naming conventions relating to autocomplete were deprecated in jQuery UI in v1.9 and have been completely removed in v1.10 (see http://jqueryui.com/upgrade-guide/1.10/#autocomplete).

What is confusing, however, is that they only mention the transition from the item.autocomplete data tag to ui-autocomplete-item, but the autocomplete data tag has also been renamed to ui-autocomplete. And it's even more confusing because the demos are still using the old syntax (and thus are broken).

.. and then goes to point out something like your patch.

So, it looks like the issue you are fixing is due to you using a newer jQuery UI version--can you all confirm what version(s) you are using?

Our patch then must include conditionals to use the right syntax depending on the current jQuery UI version. Marking as needs work.

janusman’s picture

jQuery.ui.version contains the UI version, so let's use that.

fizk’s picture

fizk’s picture

We're using jQuery UI v1.10.2.

neraprojects’s picture

Hi,

I have the same problem.
I have created in views a list of rendered items.

In preview, it works, but otherwise, it doesn't with the latest version of autocomplete.

cilefen’s picture

This is why I have a test site - the same thing happened to one of my sites.

I removed unnecessary tags on the issue.

rooby’s picture

I'm also seeing this problem.

I'm on jQuery 1.8.3 and jQuery UI 1.10.2 via the jQuery update module.

I can confirm that #6 fixes the issue for this version.

janusman’s picture

So I'm thinking we need a very simple patch doing something like this..

... pseudocode follows...

var dataElementName='autocomplete';   //For jQueryUI 1.8 for stock Drupal
if (jquery-UI-version >= 1.9) {
  dataElementName = 'ui-autocomplete';  // For jQueryUI 1.9 and above.
}

//... then later on...
{ ... snip ... }
.data(dataElementName)._renderItem = Drupal.apachesolr_autocomplete.renderItem
{ ... snip ... }
Mayday’s picture

I can confirm this is still happening on my production site. I applied the latest version (1.5) and now every jquery call is being intercepted and the warning is put into the javascript console. I am using the jquery update module and it is set to version 1.7.

Uncaught TypeError: Cannot set property '_renderItem' of undefined

Full traceback:

Uncaught TypeError: Cannot set property '_renderItem' of undefined
Drupal.apachesolr_autocomplete.processOne @ js_93x4TuYtcJhMNAZCKn1nqP435w3VsaUmaNu8lAUou3Q.js:38
(anonymous function) @ js_93x4TuYtcJhMNAZCKn1nqP435w3VsaUmaNu8lAUou3Q.js:76
e.extend.each @ jquery-1.7.2.min.js:2
Drupal.behaviors.apachesolr_autocomplete.attach @ js_93x4TuYtcJhMNAZCKn1nqP435w3VsaUmaNu8lAUou3Q.js:75
(anonymous function) @ js_3TykeRWpejhD4-J3vdlaNXdULg9xhOZhbsppK0o2bUs.js:156
e.extend.each @ jquery-1.7.2.min.js:2
Drupal.attachBehaviors @ js_3TykeRWpejhD4-J3vdlaNXdULg9xhOZhbsppK0o2bUs.js:154
Drupal.ajax.commands.insert @ js_wmFJGBxPszyYcncBchyvHkPQczwV8Zu2QzxgNV6aS88.js:5966
Drupal.ajax.success @ js_wmFJGBxPszyYcncBchyvHkPQczwV8Zu2QzxgNV6aS88.js:5824
ajax.options.success @ js_wmFJGBxPszyYcncBchyvHkPQczwV8Zu2QzxgNV6aS88.js:5585
c.success @ js_wmFJGBxPszyYcncBchyvHkPQczwV8Zu2QzxgNV6aS88.js:4566
t @ js_wmFJGBxPszyYcncBchyvHkPQczwV8Zu2QzxgNV6aS88.js:4566
nrWrapper @ edit:6

Mayday’s picture

StatusFileSize
new236.68 KB
perennial.sky’s picture

Here is the patch, may this can solve the issue

perennial.sky’s picture

Status: Needs work » Needs review
wwwprola’s picture

#18 Worked for me, thank you! I'm using v1.8 in jQuery Update.

cilefen’s picture

Issue tags: +JavaScript
swhitters’s picture

#18 worked for me, too.

renrhaf’s picture

I confirm the issue, and #18 does fix the JS error that blocked the rest of the scripts. Thank you akashjain132 !

renrhaf’s picture

Status: Needs review » Reviewed & tested by the community
renrhaf’s picture

Status: Reviewed & tested by the community » Needs work

Finally, the #8 patch seems to cause some errors in some situations

perennial.sky’s picture

Thanks Renrhaf for reviewing the patch, Can u describe some situation when it fails.

renrhaf’s picture

It seems in fact linked to the jQuery ui version.
I am using jQuery update on my project and it keeps failing with your patch after all.
I think we should considerer using the jQuery.version.ui as adviced in https://www.drupal.org/node/2625630#comment-10642432 to do something.
But we need feedbacks from users not having jQuery update to make sure we do not break anything.

perennial.sky’s picture

Status: Needs work » Needs review
StatusFileSize
new1.78 KB

Here is the new patch, Hope this will solve the issue

damienmckenna’s picture

The patch in #28 works when using jQuery 1.5 via jQuery_Update 7.x-2.7.

fractile81’s picture

Confirming that #28 works using jQuery 1.11 via jQuery Update 7.x-3.0-alpha3.

michaellenahan’s picture

Confirming that #28 works using jQuery 1.7 via jquery_update 7.x-2.7

neraprojects’s picture

Confirming that #28 works using jQuery Update 1.4

fizk’s picture

Status: Needs review » Reviewed & tested by the community

Setting patch #28 to RTBC from comments #29 - #32.

  • akashjain132 authored e5a8db2 on 7.x-1.x
    Issue #2625630 by akashjain132, jacov, nico.knaepen: Apache Solr...
janusman’s picture

Committed! Thanks all!

janusman’s picture

Status: Reviewed & tested by the community » Fixed
l-laziz’s picture

Does it relate to the Views AJAX exposed filter in block somehow?

damienmckenna’s picture

@Akumaru: Just download the latest -dev snapshot, the patch should be included already.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.