JToolBarHelper :: DeleteList - not working

I created a custom Joomla 2.5 component and uploaded the data to the grid on the admin side. All downloaded and added and edited data works well. But the removal does not work. He gives the 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 the class I used JToolBarHelper for the delete action as follows.

 JToolBarHelper::deleteList('', 'regions.delete', 'JTOOLBAR_DELETE'); 
+4
source share
1 answer

I had this problem myself, and I just figured it out. Look at your file corresponding admin/controllers/helloworlds.php , this line should be:

 public function getModel($name = 'HelloWorld', $prefix = 'HelloWorldModel') 

The first default parameter is the name of one element (in your case, possibly Region ), and the second is the name of the component. Therefore, it should be:

 public function getModel($name = 'Region', $prefix = 'NameOfYourComponentModel') 

Hope this helps in your case too. In the HelloWorld example, they use the HelloWorld code throughout the code, both the name of the component and the main view, so it is sometimes difficult to distinguish which one.

+8
source

Source: https://habr.com/ru/post/1490465/


All Articles