cancel
Showing results for 
Search instead for 
Did you mean: 

How to load js in admin panel

How to load js in admin panel

Hello,

 

In last 2 days I'm trying to load .js file into admin panel, but without any progress. I'm working on custom theme and tried tens of solutions. Cache is disabled. Those scripts which I try to load are already in magento js folder and they came with magento instalation.   

 

I tried to add this code in app / design / adminhtml / verdapay / layout / local.xml

<layout>
  <adminhtml_dashboard_index>
    <reference name="head">
            <action method="addJs"><script>lib/jquery/jquery-1.10.2.min.js</script></action>
            <action method="addJs"><script>lib/jquery/noconflict.js</script></action>         
        </reference>
  </adminhtml_dashboard_index>
</layout>

Then I changed tag <adminhtml_dashboard_index> to <adminhtml>. I combined many solution with xml tags (adding <default> instead of <adminhtml>, etc.... )

 

I also tried to add in main.xml (same path direction as local.xml) folloving code:

               <action method="addJs"><script>lib/jquery/jquery-1.10.2.min.js</script></action>
               <action method="addJs"><script>lib/jquery/noconflict.js</script></action>

I found in main.xml a lot of other script which are loaded there in backend, but any action which I did, I didn't get any result in admin page.

Some adviced told me that prototype.js has a conflict with jquery and because of that reason I tried to load another my custom script too, but still nothing. <head> tag in admin panel looks same whatever script I add/remove from main.xml file.

 

Loading js in frontend works correctly, but I really need my js file in backend too, especially for making some changes with design (menu area for example). 

 

Can you give me some useful advice about this issue?

 

Regrads,
Mladja

2 REPLIES 2

Re: How to load js in admin panel

Are you sure that your custom local.xml gets loaded?

How you tell Magento to use your custom theme?

Re: How to load js in admin panel

I reset  theme in magento backup and now everything works correctly