Jump to content


Koia

Member Since 22 Oct 2013
Offline Last Active Mar 19 2017 01:13 AM
-----

Topics I've Started

Bootstrap customer error message fails

19 March 2017 - 01:15 AM

Error message is not displayed in Bootstrap theme list view but works fine both in flexgrid and in datatables themes, see test code:
  
public function employees() {
        $crud = new grocery_CRUD();
        $crud->set_theme('bootstrap');
        $crud->set_table('employees');
        $crud->callback_before_delete(array($this, 'check_before_delete'));
        $crud->set_lang_string('delete_error_message', 'This data row with firstName "Karl" cannot be deleted.');
        $output = $crud->render();
        $this->_example_output($output);
    }
 
    function check_before_delete($primary_key) {
        $this->db->select('firstName');
        $query = $this->db->get_where('employees', array('employeeNumber' => $primary_key));
        $row = $query->result_array()[0];
        if ($row['firstName'] == 'Karl') {
            return FALSE;
        } else {
            return TRUE;
        }
    }

 


Custom error messages in Bootstrap list view

18 March 2017 - 12:10 AM

How can I, in a controller function, set a custom error message that will be displayed in the Bootstrap theme list view page. If for instance a user tries to delete a row that is not allowed to be deleted he needs to be informed that the deletion has failed. 

 

With the datagrid theme, such a message can be set using set_lang_string( 'delete_error_message',';My error message '), but this does not work in bootstrap theme.