Magento javascript object
in Mage_Adminhtml_Block_Customer_Edit_Tab_Cart, in the _pre开发者_高级运维pareColumns() function they add a column for action, there you can see
'onclick' => 'return ' . $this->getJsObjectName() . 'cartControl.removeItem($item_id);'
so i try to do the same with my custom module,
'onclick' => 'return ' . $this->getJsObjectName() . 'comentarioControl.removeItem($item_id);'
but all i get is noticia_comentario_grid10JsObjectcomentarioControl is not defined error, so, where can i define that, i don't understand
thanks
Much of the Magento Administrative User Interface is implemented by pairing each PHP UI Object with a client side UI Object. The value from getJsObjectName
is meant to be used as part of a javascript variable name.
If you are overriding and/or inheriting from this class, it's your responsibility to make sure the corresponding client side code is in place. The is accomplished is various ways in various versions of the Platform. The methodology I'd use to solve your problem here is
Look at an unmodified Mage_Adminhtml_Block_Customer_Edit_Tab_Cart in a system without your custom module
Determine what
getJsObjectName
returns in the context of #1Search the codebase for the string from #2. That will show you how the Magento system engineers added the needed client side code to the page, and will allow you to do the same in your module.
精彩评论