0

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

1
  • Have you defined any Javascript anywhere for comentarioControl? Commented Sep 2, 2010 at 17:55

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.