Matte01990 Posted July 28, 2016 Share Posted July 28, 2016 hi everybody. I've added in my controller this code snippet $this->addRowAction('view');$this->addRowAction('edit');$this->addRowAction('delete'); to add edit/delete/view buttons. exactly as I read on the docs, If I click on one of these buttons, nothing happens. So, what must I do to delete some rows? this is my code to create a new item, and it works. public function postProcess() { // checks if submit if (Tools::isSubmit('submit_form')) { $insertData = array( 'name' => Tools::getValue('name'), 'file_url' => Tools::getValue('desc') ); Db::getInstance()->insert("my_table", $insertData); } } thank you for help. Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted July 28, 2016 Share Posted July 28, 2016 Hi...can you paste your admin controller full code here ?thanks Link to comment Share on other sites More sharing options...
Matte01990 Posted July 28, 2016 Author Share Posted July 28, 2016 (edited) sure! class AdminMyContentController extends ModuleAdminController { public $bootstrap = true ; public function __construct() { // Set variables $this->table = 'mycontent'; $this->className = 'MyContent'; $this->addRowAction('view'); $this->addRowAction('edit'); $this->addRowAction('delete'); $this->allow_export = true; $this->_defaultOrderBy = 'name'; $this->_defaultOrderWay = 'ASC'; $this->bulk_actions = array( 'delete' => array( 'text' => $this->l('Delete selected'), 'icon' => 'icon-trash', 'confirm' => $this->l('Delete selected items?') ) ); $this-> fields_list = array( 'id_mycontent' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'name' => array('title' => $this->l('name'), 'width' => 120), 'file_url' => array('title' => $this->l('file_url'), 'width' => 140), ); parent::__construct(); } public function renderForm() { // make sure object is loaded if (!($obj = $this->loadObject(true))) return; $this->fields_form = array( 'legend' => array( 'title' => $this->l('Add/Edit Comment') ), 'input' => array( array('type' => 'text', 'label' => 'Nome', 'name' => 'nome'), array('type' => 'file', 'label' => 'File url', 'name' => 'file_url') ), 'submit' => array( 'title' => $this->l('Save'), 'name' => 'submit_form' ) ); return parent::renderForm(); } public function postProcess() { // checks if submit if (Tools::isSubmit('submit_form')) { $insertData = array( 'name' => Tools::getValue('nome'), 'file_url' => Tools::getValue('file_url') ); Db::getInstance()->insert("mycontent", $insertData); } } } Edited July 28, 2016 by Matte01990 (see edit history) Link to comment Share on other sites More sharing options...
Guillaume77 Posted April 18, 2023 Share Posted April 18, 2023 Hi ! I have the same problem, did you find a solution please ? Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now