c# - Set date to tbd if it is a specific date -
i tried looking around site see if question has been asked before, can't seem find it. using mvc , have controller page reads data sqlserver database display them in view contains jqgrid.
my question how take specific datetime value, "1900-01-01 00:00:00.00" , have displayed tbd?
this code 2 datetime columns:
schedule.estimatedqastartdate = (!reader.isdbnull(4)) ? reader.getdatetime(4) : (datetime?)null; schedule.estimatedorprojectedreleasedate = (!reader.isdbnull(5)) ? reader.getdatetime(5) : (datetime?)null;
the jqgrid solution have formatter date column follows
here jsfiddle sample created you.
function formatdate(cellvalue, options, rowobject) { if(cellvalue=="1900-01-01 00:00:00.00") return "tbd"; else return cellvalue; }; "use strict"; var mydata = [ {id:"1", docgroupname: "2", date: "1900-01-01 00:00:00.00", mandatory: "yes"}, {id:"2", docgroupname: "6", date: "2005-03-02 05:00:00.00", mandatory: "no"}, {id:"3", docgroupname: "6", date: "2016-08-05 08:40:00.00", mandatory: "no"}, ]; $("#list").jqgrid({ //url:'php.scripts/customers.get.php', //datatype: 'xml', //mtype: 'post', datatype: "local", data: mydata, height: "auto", colmodel :[ {name:'id', index:'id', width:55}, {name:'docgroupname', width:90}, {name:'date', formatter:formatdate, width:90, editable: true }, {name:'mandatory', index:'mandatory', width:90, editable: true} ], pager: '#pager', rownum:10, rowlist:[10,20,30], sortname: 'idcustomers', sortorder: 'asc', viewrecords: true, gridview: true, caption: 'customers', celledit: true, cellsubmit: 'clientarray', aftersavecell: function(rowid,name,val,irow,icol) { if(name=='docgroupname') { var row = $('#list').jqgrid('getrowdata',currentrow); row.doclist=''; var row = $('#list').jqgrid('setrowdata',currentrow,row); } }, beforesavecell: function(rowid,name,val,irow,icol) { // var row = $("#list").getrowdata(rowid); var row = $('#list').jqgrid('getrowdata',rowid); currentrow= rowid; }, });
Comments
Post a Comment