I created a Joomla 2.5 custom component and load data to grid on administrator side. All data loaded and adding and editing work well. But deleting is not working. It gives following error.
Fatal error: Call to a member function delete() on a non-object in
C:\wamp\www\Joomla\libraries\joomla\application\component\controlleradmin.php on line 131
In view class I used JToolBarHelper
for delete action as follows.
JToolBarHelper::deleteList('', 'regions.delete', 'JTOOLBAR_DELETE');
I had this problem myself, and I've just figured it out. Look into your file corresponding to admin/controllers/helloworlds.php
, there should be this line:
public function getModel($name = 'HelloWorld', $prefix = 'HelloWorldModel')
The first param's default value is the name of a single item (in your case, probably Region
) and the second one contains the name of the component. So it should be:
public function getModel($name = 'Region', $prefix = 'NameOfYourComponentModel')
I hope this helps also in your case. In the HelloWorld example, they use HelloWorld
all over the code, both as the name of the component and the main view, so it's sometimes hard to distinguish which one is what.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With