Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

ExtJs on frontend ? 
 
kohril
Member
 
Total Posts:  44
Joined:  2007-12-23
Lille, northernFrance
 

I am tying to use ExtJs tree component in frontend. In backend, by using the following code, ext will be properly loaded :

$this->getLayout()->getBlock('root')->setCanLoadExtJs(true);

But in frontend, this line seems not to work. How can I load extJs for frontend use ?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
kohril
Member
 
Total Posts:  44
Joined:  2007-12-23
Lille, northernFrance
 

--- solution ---

creating a template with following content :

<script type="text/javascript" src="<?=$this->getJsUrl()?>extjs/ext-tree.js"></script>
<script type="text/javascript" src="<?=$this->getJsUrl()?>extjs/ext-tree-checkbox.js"></script>
<link rel="stylesheet" type="text/css" href="<?=$this->getJsUrl()?>extjs/resources/css/ext-all.css"/>
<
link rel="stylesheet" type="text/css" href="<?=$this->getJsUrl()?>extjs/resources/css/ytheme-magento.css"/>
<
script type="text/javascript">
        
Ext.BLANK_IMAGE_URL '<?=$this->getJsUrl()?>extjs/resources/images/default/s.gif';
        
Ext.UpdateManager.defaults.loadScripts false;
        
Ext.UpdateManager.defaults.disableCaching true;
</script>

Add it to header in your layout file :

<reference name="head">
        <
block type="core/template" name="my.name.extjs" template="myfolder/myextblocktemplate.phtml"/>
    </
reference>

Enjoy !

 
Magento Community Magento Community
Magento Community
Magento Community
 
gordon
Jr. Member
 
Total Posts:  14
Joined:  2007-11-07
 

Thanks for sharing. Gonna try this out.

 
Magento Community Magento Community
Magento Community
Magento Community
 
aronkerr
Jr. Member
 
Total Posts:  4
Joined:  2010-09-09
 

Sorry for bringing this post back from the dead but I have been looking for a way to do this for the last few minutes and thought I would update this with a simpler method for adding the extJs to the front end. If you are, like I was, trying to add this to your own module just add the script to your modules layout/[modulename].xml. Use a layout update like:

<?xml version=\"1.0\"?>
<layout version \"0.1.0\">
    <
[modulename]_index_index>
        <
reference name=\"head\">
            <
action method=\"addJs\"><script>extjs/ext-tree.js</script></action>                
            <
action method=\"addJs\"><script>extjs/ext-tree-checkbox.js</script></action>
            <
action method=\"addCss\"><script>extjs/resources/css/ext-all.css</script></action>
            <
action method=\"addCss\"><script>extjs/resources/css/ytheme-magento.css</script></action>
        </
reference>
        </
[modulename]_index_index>
</
layout>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top