Created
October 22, 2012 23:58
-
-
Save sirBlond/3935653 to your computer and use it in GitHub Desktop.
Drupal 7 simple views sorting realization via JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
function goURL(){ | |
var url = document.getElementById("selectID").options[document.getElementById("selectID").selectedIndex].getAttribute("value"); | |
window.location = url; | |
} | |
</script> | |
Sort by | |
<select id="selectID" onchange="javascript:goURL();"> | |
<option value="?sort_by=title&sort_order=ASC">By title(ASC)</option> | |
<option value="?sort_by=created&sort_order=ASC">By creation date(ASC)</option> | |
<option value="?sort_by=field_CustomFieldName_value&sort_order=ASC">By your custom field (ASC)</option> | |
<option value="?sort_by=title&sort_order=DESC">By title(DESC)</option> | |
<option value="?sort_by=created&sort_order=DESC">By creation date(DESC)</option> | |
<option value="?sort_by=field_CustomFieldName_value&sort_order=DESC">By your custom field(DESC)</option> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment