tel8618217223380 / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

Add Support for jQuery #238

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Add option of using scriptaculous or jquery because some jquery plugins clash 
with scriptaculous and makes life unbearable somtimes

Original issue reported on code.google.com by xtree...@gmail.com on 25 Mar 2010 at 3:08

GoogleCodeExporter commented 9 years ago
That's pretty straightforward. Just create a function with the following 
implementation

function jqry()
{
  return jQuery.noConflict();
}

and then replace all "$(<param>)" calls with "jqry()(<param>)" in the jQuery 
scripts. 

There might be compatibility issues with this solutions I'm not aware of, but 
all 
jQuery plugins I've incorporated into my apps worked just fine for me using 
this 
simple hack.

Original comment by google...@pcforum.hu on 4 Apr 2010 at 1:44

GoogleCodeExporter commented 9 years ago
This must be an article to help Prado user make code with jquery. It saves time!

Original comment by long.tru...@nuvixa.com on 20 May 2011 at 7:31

GoogleCodeExporter commented 9 years ago
And with some example is really great!

Original comment by long.tru...@nuvixa.com on 20 May 2011 at 7:32

GoogleCodeExporter commented 9 years ago
Example :

class JavascriptHelper {
  public static function publishJQueryCode($page) {
    $clientScript = $page->getClientScript();

    $endScript=Constants::JQUERY_BEGIN . Constants::CRLF;
    $endScript.="$('.selectorExample').jQueryPluginExample();" . Constants::CRLF;
    $endScript.=Constants::JQUERY_END;

    $clientScript->registerEndScript('JQUERY_CODE',$endScript);
    }
}

class Constants {
  const CRLF = "\n";

  const JQUERY_BEGIN="( function($) {\n";
  const JQUERY_END="} ) ( jQuery );\n";
}

Original comment by stbl...@gmail.com on 20 Sep 2011 at 9:37

GoogleCodeExporter commented 9 years ago

Original comment by ctrlal...@gmail.com on 25 Jun 2012 at 1:56

GoogleCodeExporter commented 9 years ago
I just add following row to end of my jquery file:

var $j = jQuery.noConflict();

then I can use $j as jquery on everywhere. All (right coded) jQuery plugins 
should work and I have not come across any problems yet with jQuery in Prado.

Original comment by sampsa.s...@inoob.com on 27 Jul 2012 at 9:52

GoogleCodeExporter commented 9 years ago
That should be

   jQuery = jQuery.noConflict();

The above wrapper is still needed if the jQuery control class is not defined as 
local to a function, otherwise the $() called will be that of prototype's, not 
jQuery's, which will prevent most libraries from working.

Original comment by google...@pcforum.hu on 27 Jul 2012 at 11:07

GoogleCodeExporter commented 9 years ago

Original comment by ctrlal...@gmail.com on 21 Jan 2013 at 7:03

GoogleCodeExporter commented 9 years ago

Original comment by ctrlal...@gmail.com on 24 Jul 2013 at 1:46

GoogleCodeExporter commented 9 years ago
Moved to github: https://github.com/pradosoft/prado/issues

Original comment by ctrlal...@gmail.com on 1 Oct 2013 at 10:14