Created
July 5, 2011 19:41
-
-
Save kblomqvist/1065701 to your computer and use it in GitHub Desktop.
An idea of the new api for setting js into Zend_JQuery/Dojo onload script container
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
<?php | |
// Old way | |
// Set onload script | |
$this->jQuery()->onLoadCaptureStart(); ?> | |
var availableTags = [ | |
"ActionScript", | |
"AppleScript", | |
"Asp", | |
"BASIC", | |
"C", | |
"C++", | |
"Clojure", | |
"COBOL", | |
"ColdFusion", | |
"Erlang", | |
"Fortran", | |
"Groovy", | |
"Haskell", | |
"Java", | |
"JavaScript", | |
"Lisp", | |
"Perl", | |
"PHP", | |
"Python", | |
"Ruby", | |
"Scala", | |
"Scheme" | |
]; | |
$( "#tags" ).autocomplete({ | |
source: availableTags | |
}); | |
<?php $this->jQuery()->onLoadCaptureEnd(); ?> | |
<?php | |
// New way to do it | |
// Set onload script | |
$this->jQuery()->onload = <<<JS | |
var availableTags = [ | |
"ActionScript", | |
"AppleScript", | |
"Asp", | |
"BASIC", | |
"C", | |
"C++", | |
"Clojure", | |
"COBOL", | |
"ColdFusion", | |
"Erlang", | |
"Fortran", | |
"Groovy", | |
"Haskell", | |
"Java", | |
"JavaScript", | |
"Lisp", | |
"Perl", | |
"PHP", | |
"Python", | |
"Ruby", | |
"Scala", | |
"Scheme" | |
]; | |
$( "#tags" ).autocomplete({ | |
source: availableTags | |
}); | |
JS; | |
// Append onload script (with the short one) | |
$this->jQuery()->onload .= '$( "#datepicker" ).datepicker();' | |
// Clear onload script | |
$this->jQuery()->onload = ''; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment