简体   繁体   中英

Date field's rows are not shown in the grocery crud table

I am new to Grocery CRUD. I am impressed by how much time saver this library is and i want to thank all great developers who worked on this project.

i have a small problem with showing the date field in the table. when i press the edit button , it's shown in the edit and view pages. but it doesn't appear in the table.

Even if i create the record myself from the add record button, it's saved successfully but not shown in the table. i have checked many things like the default format of the date in the library.

$config['grocery_crud_date_format'] = 'sql-date';

I tried different web browsers

this is my table and how i update the date and save it to the DB:

$datestring = "%Y-%m-%d";
$time = time();

 $data = array(
                'Attendence_date_daily' => mdate($datestring, $time),
                'Check_in_time' => null,
                'Check_out_time' => null,
                'Attendence_status' => null,
                'Employee_comment' =>null,
                'Deducted_today' => 0,
                'user_id' => $row->id
                );

this is how i created the table

public  function edit_daily_record()
                    {
                              $crud = new grocery_CRUD();

                                       $crud->columns('daily_record_id','Attendance_date_daily','Check_in_time','Check_out_time','Attendence_status','Employee_comment','Deducted_Today','user_id');
                                       $crud->set_table('daily_attendence_record');
                                       $crud->display_as('Attendance_date_daily','Date')
                                                 ->display_as('user_id','Employee');
                                       $crud->set_subject('daily record');
                                       $crud->set_relation('user_id','users','username');
                                       $output = $crud->render();
                            $this->_example_output($output);
                    }

where 'Attendance_date_daily' is of type date in mysql DB . All fields are shown correctly except this date

'daily_record_id' is auto increment PK 'user_id' is a FK

can you please help me with this problem? image 1

图片1

image 2

图片2

I solved this with the help of Mr. Paul Savostin one of the Advanced members in Grocery CRUD Advance members.

the issue is a simple typo. the name of the filed in the database is different than the controller by one letter.

this shows how can a letter change the whole code!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM