简体   繁体   English

在插入时添加具有回调函数的日期时,Datepicker不会加载到GroceryCrud中

[英]Datepicker doesn't load in GroceryCrud when adding date with callback function on insert

When I try to fill the date box with the current time with a callback function like this: 当我尝试使用这样的回调函数填充当前时间的日期框时:

<?php    
// in controller:
$this->grocery_crud->callback_add_field('date',array($this,'_date_fill_now'));


protected function _date_fill_now()
{
        return '<input name="date" type="text" value="'. current_time() . '" maxlength="19" class="datetime-input">';
}

The datepicker js files will not be loaded, so the datepicker doesn't pop up when I click on the date field. 将不会加载datepicker js文件,因此单击日期字段时不会弹出datepicker。 How can I load them the right way ? 我怎样才能以正确的方式加载它们?

A quick way to do it without changing the core of grocery CRUD is to add these lines of code at your controller: 在不更改杂货CRUD核心的情况下快速完成此操作的方法是在控制器中添加以下代码行:

$this->grocery_crud->set_js('assets/grocery_crud/js/jquery-1.7.1.min.js');
$this->grocery_crud->set_js('assets/grocery_crud/js/jquery_plugins/jquery.ui.datetime.js');
$this->grocery_crud->set_js('assets/grocery_crud/js/jquery_plugins/config/jquery.datetime.config.js');
$this->grocery_crud->set_js('assets/grocery_crud/js/jquery_plugins/jquery-ui-1.8.10.custom.min.js');
$this->grocery_crud->set_js('assets/grocery_crud/js/jquery_plugins/config/jquery.datepicker.config.js');

$this->grocery_crud->set_css('assets/grocery_crud/css/ui/simple/jquery-ui-1.8.10.custom.css');
$this->grocery_crud->set_css('assets/grocery_crud/css/jquery_plugins/jquery.ui.datetime.css');

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

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