datepicker的xeditable defaultViewDate选项不起作用 [英] xeditable defaultViewDate option for datepicker doesn't work
问题描述
任何帮助将不胜感激,我尝试了以下代码进行x可编辑的版本1.5.0,其他选项如:'weekStart'起作用,但'setDate','defaultViewDate'等选项不起作用,这是我的代码有问题? 我的代码:
Any help would be appreciated I tried the below code for x-editable version 1.5.0 the other options like: 'weekStart' works but options like 'setDate', 'defaultViewDate' doesn't work is something wrong with my code? My Code:
<a href="#" id="dob" data-type="date" data-pk="1" data-title="Select date">15/05/1984</a>
<script type="text/javascript>
$('#dob').editable({
format: 'yyyy-mm-dd',
viewformat: 'dd/mm/yyyy',
datepicker: {
weekStart: 1,
defaultViewDate: {
year: 2012,
month: 11,
day: 11
}
}
});
</script>
推荐答案
您可以在HTML中使用data-value
属性设置默认日期值
You can use data-value
attribute in your HTML to set default date value
<a href="#" id="dob" data-type="date" data-value="2012-11-11" data-pk="1" data-title="Select date"></a>
这是一种解决方法检查更新的jsfiddel .
如果要使用默认日期打开日期选择器,则data-value
为空.您可以使用可编辑的defaultValue
选项.
If you want to open datepicker with default date, when data-value
is empty. you can use defaultValue
option of editable.
$('#dob').editable({
format: 'yyyy-mm-dd',
viewformat: 'dd/mm/yyyy',
url: '/post',
defaultValue: "11/11/2012"
})
在此处检查示例 http://jsfiddle.net/z0yqgL9k/6/
这篇关于datepicker的xeditable defaultViewDate选项不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!