tags:

views:

21

answers:

1

in Mage_Adminhtml_Block_Customer_Edit_Tab_Cart, in the _prepareColumns() 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

A: 

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

  1. Look at an unmodified Mage_Adminhtml_Block_Customer_Edit_Tab_Cart in a system without your custom module

  2. Determine what getJsObjectName returns in the context of #1

  3. Search 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.

Alan Storm
thanks, problem solved, i was inheriting but missing some step...for example, Mage_Adminhtml_Block_Customer_Edit_Tab_Cart they set a template customer/tab/cart.phtml, there is where the jsObject is created and all its functions....now, everything in my module is working ok, thanks again
Kstro21