Jump to content

Sonelal Singh

Member Since 01 Jul 2015
Offline Last Active Sep 30 2015 08:16 AM

Posts I've Made

In Topic: [EXTRA] Categories and Subcategories Dropdown list.

21 September 2015 - 07:48 AM

Hi web-johnny,


How can I use your code when we have to use category with multiple fields(for example editing user info).


For example - 


users table have following  fields --->user_id,name,gender,category


and category table have following fields ---> id,category,parent_id



        $crud = new grocery_CRUD();
        $crud->set_relation('category', 'ci_categories', 'category');


       /* Add this customisation for parent_relation */
        $primary_id_field  = 'id';
        $table_name   = 'categories';
        $relation_field_name = 'parent_id';
        $parent_field   = 'parent_id';
        $title_field   = 'category';
        $title_display_as  = 'Select Categoria';
        $where    = array('stato'=>'1');//not required
        $same_table   = true; //not required, the default is false
        $output['output'] = $crud->render();

        $this->load->view('template', $output);



I am not able to figure out how can I use category field with other tables.






In Topic: How can I convert datetime field to "Y-m-d" formate

02 July 2015 - 08:50 AM

Hey Paul,


Thanks for your help.

It worked   :) 

In Topic: How can I convert datetime field to "Y-m-d" formate

02 July 2015 - 06:16 AM

Hi Paul,


Thanks for your reply.


In database my field name is "create_date" and date type is "timestamp" and default value is "CURRENT_TIMESTAMP".


But when I fetch and displaying this field in front end it display like "30/11/1999" (d/m/y) format.


I want to display this field like "1999-11-30".




I have applied you suggestion in my code like below -


$crud->callback_columns('created_date', array($this, 'callback_date'));


and in same controller I have created callback function like below 

public function callback_date($val, $row)
        return date('Y-m-d', strtotime($val));


But I am getting below error

Call to undefined method Grocery_CRUD::callback_columns()