【发布时间】:2017-12-19 20:50:33
【问题描述】:
我有以下数据表:
代码如下:
HTML:
<table id="rentals" class="table table-bordered table-hover">
<thead bgcolor="#ADD8E6">
<tr>
<th>Book Name</th>
<th>Date Rented</th>
<th>Estimated Return Date</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
Javascript
table = $("#rentals").DataTable({
ajax: {
url: query,
dataSrc: ""
},
columns: [
{
{
data: "book.title"
},
{
data: "dateRented",
render: function (data) {
returnDate = data;
},
{
data: "estimatedReturnDate",
render: function (data) {
var date = new Date(data);
var month = date.getMonth() + 1;
var day = date.getDay();
return date.getDate() + "/" + month + "/" + date.getFullYear();
}
]
});
我希望“估计返回日期”列更改为 jquery datepicker,当用户单击“单击我”按钮时,默认值等于该列的日期值,并在用户单击时更改回文本字段让我们说一个取消按钮。
我怎样才能做到这一点?
【问题讨论】: