Update to libraries/html/grid.php. Fixes grid.sort for components that use query strings in their URIs. #1541

Merged
merged 1 commit into from Sep 23, 2012

4 participants

@zhevron

Some browsers will follow the "#" hyperlink generated by JHTML's
grid.sort command unless the javascript onclick returns false. This will
cause components with URLs that look like "index.php?option=com_example"
to redirect to "index.php#", effectively breaking sorting functions.
The commit adds "return false;" to the generated javascript in onclick.
This affects at least frontend functions that use this in Joomla! 2.5.x

@pasamio

Why is every single line of the file marked as deleted and then re-added?

@zhevron

That's...a very good question. I'm starting to suspect my editor had fun with the EOLs or something. That's not like Notepad++ at all! I'll actually look into that.

@pasamio

It might have swapped to DOS line endings and they need to be UNIX. Make sure you've got the right endings and then rebase the branch so the two commits don't wipe out the history for the file.

@zhevron

There. Swapped to UNIX EOLs and rebased the branch.

@pasamio

Sorry, I should have been clearer. With the rebase can you squash the two commits together to form one commit? Otherwise the history of the file becomes "Fixing line endings" which doesn't help people trying to workout why something is done a particular way into the future.

Ref: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits

(Likely you want to use the fixup option because it will discard the second commits message rather than attempt to preserve it if you version of Git supports this)

Thomas Lokshall Fixes bug that causes certain browser to follow the # link on sorted …
…columns

Some browsers will follow the "#" hyperlink generated by JHTML's
grid.sort command unless the javascript onclick returns false. This will
cause components with URLs that look like "index.php?option=com_example"
to redirect to "index.php#", effectively breaking sorting functions.
This affects at least frontend functions that use this in Joomla! 2.5.x
92cc33a
@zhevron

Hopefully it's fixed now! This is what you get for being used to Bazaar and everything.

@pasamio pasamio merged commit aed408f into joomla:staging Sep 23, 2012
@pasamio

Looks good, thanks!

@nicksavov

Hi Zhevron,

We're trying to add this fix to the CMS at http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=29998 . Could you provide some steps to replicate in there, as well as Browser and Browser version?

Thanks in advance!

Kind regards,
Nick

@zhevron

It only seemed to occour when it was used in a frontend module. The issue, however, is a known thing in Javascript.
See http://cs.wellesley.edu/~cs110/examples/return.html for some examples and reproductions of the fault.
I'm able to reproduce the fault on that page from both Chrome 24.0.1312.52 and Internet Explorer 8.

@nicksavov

Thanks Zhevron!

@infograf768
Joomla! member

In fact found out this was necessary in modal when inserting article.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment