简体   繁体   English

日期字段的行未显示在杂货杂货表中

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

I am new to Grocery CRUD. 我是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 . 其中“ Attendance_date_daily”在mysql DB中的类型为date。 All fields are shown correctly except this date 除此日期外,所有字段均正确显示

'daily_record_id' is auto increment PK 'user_id' is a FK 'daily_record_id'是自动增量PK'user_id'是FK

can you please help me with this problem? 您能帮我解决这个问题吗? image 1 图片1

图片1

image 2 图片2

图片2

I solved this with the help of Mr. Paul Savostin one of the Advanced members in Grocery CRUD Advance members. 我在杂货CRUD高级会员中的高级会员之一Paul Savostin先生的帮助下解决了这个问题。

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! 这显示了字母如何更改整个代码!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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