我将日期选择器附加到某个范围但我想要附加到输入中的弹出式样式和功能。我可以将css更改为position:absolute,但是datepicker不会在转义,模糊,选择等时关闭。我是否必须手动处理弹出功能(例如关闭datepicker)或有没有办法禁用内联模式?
脚本
//Inline Editing: Dates
$('.date span').live('click', function () {
var $date = $(this);
$date.datepicker({
onSelect: function (val, dp) {
var $job = $date.closest('.job');
var data = {
entityTypeName: 'Sale',
entityId: $job.attr('data-id'),
propertyName: $date.attr('data-property-name'),
propertyValue: val
};
$.post(urlSaveProperty, data, function (r) {
if (r == 'ok') {
$date.effect('highlight');
} else {
alert(r);
$date.val('error');
}
});
}
});
$(this).datepicker('show');
});
CSHTML
<td class="contract-date date">
<span data-property-name="ContractDate" >
@job.ContractDate.SimplifyThisYear()
</span>
</td>