0

I'm discovering magento since 1 week. But i have a problem now. I need to include a javascript file in my admin panel to sort a list according to another. I'm using magento 1.9 and i really don't find any tutorial to do this.

Please can someone explain me clearly how to do this because i'm really stuck at this point.

2
  • Do you want to add the js globally to your backend or just to a specifiv grid view? Are you using a module or just altering core files? Commented May 27, 2016 at 10:05
  • "(Ok, my message has been deleted, i don't know why...)" - because it is not an answer. Stack Exchange does not work like a forum. If you want to add details, edit the question. Only post an answer if you have a solution. Commented May 27, 2016 at 15:43

2 Answers 2

0

First you have to choose a relevant layout(.xml) file based on the grid/page you want to include your javascript in.

Then in that layout you need to add the below code in the relevant section:

<layout>
  <adminhtml_{relevant_layout_handle}>
    <reference name="head">
            <action method="addJs"><script>my_extension/adminhack.js</script></action>
            <action method="addJs"><script>prototype/prototype.js</script></action>         
        </reference>
  </adminhtml_{relevant_layout_handle}>
</layout>

Then you need to clear Magento caches and check if your file is loaded or not.

Hope this works for you

0

First you have to create one module and with in module's layout file you can add a javascript and css using above answer syntax.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.