比如我要直接在这个表格中修改时间,前后台如何办?还有这个时间怎么样才能显示分,秒?
比如;
var varTime;
var vm = {
init: function () {
var lastsel2;
$('#div-list').jqGrid({
url: '@Url.Content("~/IDE/LatterAction/GetListInfo")?rid=@ViewBag.Rid',
sortname: 'PfinishTime',
multiselect: false,
pager: $('#div-pager'),
rowNum:10,
rowList:[10,20,30],
height: '100%',
colNames: ['编号','再鉴定名称','后续行动内容','负责人','计划完成日期','后续行动状态','录入人','最新进展','操作'],
colModel: [
{ name: 'LatterId', index: 'LatterId', hidden: true, key: true },
{ name: 'Name', index: 'Name',align:'left', width:90,
formatter: function (cellvalue, options, rowObject) {
return '<a href="#" onclick="vm.view(\''+rowObject.IdentId+'\')">'+cellvalue+'</a>'; }
},
{ name: 'LatterContent', index: 'LatterContent',align:'left',width:120},
{ name: 'ChargePerson',index:'ChargePerson',align:'left',width:100},
{ name: 'PfinishTime',index:'PfinishTime',align:'center', editable: true,width:100,formatter: 'date', datefmt: 'Y-m-d'},
{ name: 'LatterState',index:'LatterState',align:'left',width:60},
{ name: 'EnterMan',index:'EnterMan',align:'left',width:90},
{ name:'NewMarch',index:'NewMarch',align:'left'},
{ name: $.jgrid.defaults.cleverjqgridactions,sortable:false,width: 60,align: 'center',
formatter: function (cellvalue, options, rowObject) {
return '<div class="ui-btn-imgarea"><span title="删除" class="ui-icon ui-icon-delete" style="cursor:pointer" onclick="vm.remove(\'' + rowObject.LatterId + '\');"></span><span title="编辑" class="ui-icon ui-icon-edit" style="cursor:pointer" onclick="vm.update(\'' + rowObject.LatterId + '\');" ></span></div>';
}
}
],
onSelectRow: function(id){
varTime = $('#div-list').getCell( id,"PfinishTime" );
if(id && id!==lastsel2){
jQuery('#div-list').jqGrid('restoreRow',lastsel2);
jQuery('#div-list').jqGrid('editRow',id,true);
lastsel2=id;
}
},
editurl: '@Url.Content("~/IDE/LatterAction/GetListInfo")',
loadComplete: function(){
var ids = $('#div-list').getDataIDs();
/////设定背景色
var ids = $('#div-list').getDataIDs();
for ( var i=0; i<ids.length;i++ ){
var rowData = $("#div-list").getRowData(ids[i],{LatterState:"LatterState"})
if(rowData.LatterState=="新生成"){
$('#div-list').setRowData(ids[i],null,{ background:"#EACB48"});
}
if(rowData.LatterState=="跟踪中"){
$('#div-list').setRowData(ids[i],null,{ background:"#93EDE0"});
}
if(rowData.LatterState=="已完成"){
$('#div-list').setRowData(ids[i],null,{ background:"#D3DEDE"});
}
if(rowData.LatterState=="已取消"){
$('#div-list').setRowData(ids[i],null,{ background:"#D3DEDE"});
}
};
},
gridComplete: function(){
$('#div-list').setGridWidth($(window).width()-3);
}
});
$('#div-list').jqGrid('navGrid', '#div-pager', { del: false, add: false, edit: false, search: false, refresh: false, view: false })
},
remove: function (id) {
$.dialog.confirm("您确定执行此次操作吗,删除后将无法恢复?", function () {
$.post('@Url.Content("~/IDE/LatterAction/Delete")?id='+id, function (data) {
var json = $.parseJSON(data);
json.result?vm.search():$.dialog.alert(json.msg);
})
});
},
update: function (id) {
$("#ifrm").attr("src",'@Url.Content("~/IDE/LatterAction/Update")?id='+id);
$.dialog.show({width: 420,height: 310,title: "修改",content: $("#div-ifrm")});
},
view:function(iid){
window.location.href='@Url.Content("~/IDE/LatterAction/ShowDetail")?id='+iid;
},
search: function () {
var params = $.param({rid:'@ViewBag.Rid', word:$("#word").val(),state:$("#LatterState").val()});
$('#div-list').jqGrid('setGridParam', { url: "@Url.Content("~/IDE/LatterAction/GetListInfo")?"+params, page: 1 }).trigger("reloadGrid");
},stateRefresh:function(){
var params = $.param({rid:'@ViewBag.Rid', word:$("#word").val(),state:$("#LatterState").val()});
$('#div-list').jqGrid('setGridParam', { url: "@Url.Content("~/IDE/LatterAction/GetListInfo")?"+params, page: 1 }).trigger("reloadGrid");
}
};
$(function(){
$("#btnSearch").on('click', vm.search);
$("#LatterState").on('click',vm.stateRefresh);
vm.init();
});上面是我的具体代码js中的,
我只想可以直接在这个jqgrid表格修改时间,还有这个时间如何可以显示小时,分钟,秒??
博主解决了告诉我一声。。