The glossary view with AJAX enabled in combination with Language detection by URL does not work. It appears the argument does not get applied.

For instance, clicking 'F' should filter nodes that start with F, however it loads all results as if no contextual filter was provided. If I disable URL detection -- thus making the POST http://example.com/views/ajax instead of http://example.com/en/views/ajax -- it works.

If I disable AJAX, the view works as it should (/glossary/f loads with F results). Other AJAX calls in the site with the language prefix do not cause any issue.

Files: 
CommentFileSizeAuthor
#1 views-language_prefix_for_ajax-1803758-1.patch536 bytesbsuttis
Test request sent.
Previous result: PASSED: [[SimpleTest]]: [MySQL] 1,658 pass(es).
[ View ]

Comments

bsuttis’s picture

Status:Active» Needs review
StatusFileSize
new536 bytes
Test request sent.
Previous result: PASSED: [[SimpleTest]]: [MySQL] 1,658 pass(es).
[ View ]

Narrowed it down to js/base.js

Attached is a patch, it checks for the existence of Drupal.settings.pathPrefix and prepends it to viewPath.

This makes if (viewPath && path.substring(0, viewPath.length + 1) == viewPath + '/') pass, as without the language prefix path.substring(0, viewPath.length + 1) was removing the last 3 characters of the path

Without this patch, this happens:
path.substring(0, viewPath.length + 1) == en/admin/organizatio
viewPath + '/' == admin/organizations/

With this patch:
path.substring(0, viewPath.length + 1) == en/admin/organizations/
viewPath + '/' == en/admin/organizations/

JulienThomas’s picture

Good afternoon.

Thank your for this patch. It solved my bug too!

issa.haddadin’s picture

Thank you..

It worked with me too!

issa.haddadin’s picture

Version:7.x-3.5» 7.x-3.7
Status:Needs review» Reviewed & tested by the community

I tried this with latest views "7.x-3.7" version and it's working good.

weri’s picture

Priority:Normal» Major

I applied this patch to 7.x-3.7 and the ajax call works also with language prefixes.

candelas’s picture

Version:7.x-3.7» 7.x-3.x-dev

thanks @bsuttis :) it works perfect.

i tested it in the dev version to help this patch to be commited.

i had the same problem: the glossary view didnt work with ajax in a multilingual site, but it worked without ajax.
i applied the patch in the dev version and now ajax works.
i hope that it can be commited to the dev version.
thanks to all people that contributes to views :)

e5sego’s picture

Issue summary:View changes
Issue tags:+i18n
e5sego’s picture

Applyed the patch to 7.x-3.7 which solved the problem using glossary + ajax + internationalization / i18n.

Also added i18n tag to this issue, it's might be hard to find the patch. Hope that's right.

alienzed’s picture

JUST what I was looking for. I must admit it took me some time to find this thread. I wonder why this patch is not in Views 3.8...
I can confirm that patching 3.8 works as well. This is a bug though and should be fixed permanently right?

dawehner’s picture

weri’s picture

The patch works with 3.8 and DEV. I hope it gets added to the next release.

stefan.r’s picture

This works, can we get this committed?

bendev’s picture

I confirm this is working for me too with Views 3.8
thank you