php - 无法为 DateRangePicker::widget 设置占位符
问题描述
我的 yii2 应用程序中有以下小部件
<?= DateRangePicker::widget([
'model'=>$model,
'attribute' => 'fact_close_date_range',
'options'=>[
'placeholder'=>'Фактическая дата закрытия займа',
'class'=> 'ui input',
'id'=> 'fact_close_date_range'
],
'useWithAddon'=>false,
'convertFormat'=>true,
'presetDropdown'=>false,
'hideInput'=>false,
'pluginOptions'=>[
'opens' => 'right',
'locale'=>[
'format' => 'Y-m-d'
],
],
]);
?>
但是在初始加载时,我得到的是为今天设置两个日期的输入。例如 17.03.2021 - 17.03.2021,应该是我的占位符Фактическая дата закрытия займа
。kartik 的文档没有描述这样的事情
解决方案
尝试这个 :
<?= DateRangePicker::widget([
'name'=>'date_range_2',
'presetDropdown'=>true,
'convertFormat'=>true,
'value' => $model->date_range,
// 'includeMonthsFilter'=>true,
'pluginOptions'=> ['locale' => ['format' => 'Y-m-d']],
'options' => ['id'=> 'tgl-search', 'class' => 'invoice-search','placeholder' => 'Select range...']
]);
推荐阅读
- blogger - 如何获取所有仅包含数字的帖子标签?
- angular - 通过 Angular 8 中的 API 推送新数据的 Animate Pie 聊天
- c++ - Eclipse/gdb C/C++ 项目调试控制台输入缓冲
- visual-studio - 在哪里可以下载用于 WebForms 的 Microsoft Report Viewer 版本 15?
- java - 自定义对象的 ListView 上的类型不兼容错误
- python - IDE 相关,无法跨 IDE 平台访问的库
- c# - 性能安全与不安全
- c++ - 如何在编译时获得多维 std::vector 的深度?
- angular - 是否可以使用角度谷歌地图对纬度和经度进行双向绑定?
- excel - 删除未使用的表格行