function initEntryDetail(){ $('#Business_entryDetail_show_datagrid').datagrid({ loadMsg: '数据加载中请稍后……', url:"/manage/platform/dispatch/bookWarehouse/btpBookingEntry//listJson.html", queryParams: { search_EQ_dispatchId: $("#dispatchId").val(), search_EQ_isDelete:0 }, border:false, fitColumns:false, singleSelect:false, idField:'id', pagination:true, pageSize:20, pageList:[ 10, 20, 30, 40, 50], sortName:'id', sortOrder:'desc', checkOnSelect:true, selectOnCheck:true, columns: [[ {field: 'id',title: "id",hidden: true}, { field: 'actionId', title: "操作", formatter: function (value, row, index) { return "<a href='javascript:void(0)' onclick='makeTrueTime(" + value + "," + JSON.stringify(row) + "," + index + ")'>确认收货</a> " } }, {field: 'isClick',title: "isClick",hidden: true}, {field: 'billLadingNo',title: "提单号/运单号", width:150}, {field: 'oneDistance',title: "一程日期",width:150}, {field: 'twoDistance', width:250,title:"二程日期"}, {field: 'prematchShipDate',title: "预计到货日期",width:150}, {field: 'shipCompany',title: "海船公司",width:150}, {field: 'containerDate', width:250,title:"放箱日期"}, { field: 'attachment', width: 250, title: "放箱单上传", formatter: function(value, row, index) { return '<a href="javascript:void(0)" class="attachment-btn">上传附件</a>'; } }, {field: 'billLadingDate', width:250,title:"提单日期"}, {field: 'actOneDistance', width:250,title:"实际一程日期"}, {field: 'actTwoDistance', width:250,title:"实际二程日期"}, {field: 'arriveDate', width:250,title:"运抵日期"}, {field: 'receiptConfimDate', width:250,title:"收货确认日期"}, ]] }) }makeTrueTime设置当前时间到receiptConfimDate列上展示
时间: 2023-07-19 11:40:58 浏览: 117
VB中如何正确导出DataGrid的数据.rar_VB datagrid 输出_VB_DataGrid_datagrid_dat
你可以在 `makeTrueTime` 方法中,调用 datagrid 的 `updateRow` 方法,更新 `receiptConfimDate` 列的值。具体步骤如下:
1. 获取 datagrid 对象和当前行的索引值。
```javascript
var datagrid = $('#Business_entryDetail_show_datagrid');
var index = datagrid.datagrid('getRowIndex', row);
```
2. 获取当前时间,并将其格式化为你需要的日期格式。
```javascript
var now = new Date();
var dateStr = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate();
```
3. 使用 `updateRow` 方法更新 `receiptConfimDate` 列的值。
```javascript
datagrid.datagrid('updateRow', {
index: index,
row: {
receiptConfimDate: dateStr
}
});
```
完整的 `makeTrueTime` 方法代码如下:
```javascript
function makeTrueTime(value, row, index) {
var datagrid = $('#Business_entryDetail_show_datagrid');
var index = datagrid.datagrid('getRowIndex', row);
var now = new Date();
var dateStr = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate();
datagrid.datagrid('updateRow', {
index: index,
row: {
receiptConfimDate: dateStr
}
});
}
```
当你点击确认收货链接时,就会触发该方法,自动将当前时间更新到 `receiptConfimDate` 列上展示。
阅读全文