Categories | Question details Back To List | ||
Date in dhtmlxGrid Hi, I am using dhtmlxGrid, where one column type is dhxCalendar, whenever I going to add the date in blank cell it showing calendar with current date. but when I going to edit the cell which having the date in the cell it showing calendar with year 1970, where I want calendar with default date which is in the cell. ex. if cell contain the date 22/JAN/2009 it showing the calendar of year Jan 1970. Please refer below code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Critical Parameter Manager</title> <link rel="stylesheet" href="CSS/whirlpool.css" type="text/css"/> <link rel="STYLESHEET" type="text/css" href="dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid_skins.css"> <link rel="STYLESHEET" type="text/css" href="dhtmlx/dhtmlxCalendar/codebase/dhtmlxcalendar.css"> <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxLayout/codebase/dhtmlxlayout.css"> <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxLayout/codebase/skins/dhtmlxlayout_dhx_blue.css"> <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxWindows/codebase/dhtmlxwindows.css"> <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxWindows/codebase/skins/dhtmlxwindows_dhx_blue.css"> <script src="dhtmlx/dhtmlxGrid/codebase/dhtmlxcommon.js"></script> <script src="dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js"></script> <script src="dhtmlx/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script> <script src="dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_splt.js"></script> <script src="dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_group.js"></script> <script src="dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script> <script src="dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor_debug.js"></script> <script src="dhtmlx/dhtmlxCalendar/codebase/dhtmlxcalendar.js"></script> <script src="dhtmlx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_dhxcalendar.js"></script> <script src="dhtmlx/dhtmlxLayout/codebase/dhtmlxcommon.js"></script> <script src="dhtmlx/dhtmlxLayout/codebase/dhtmlxlayout.js"></script> <script src="dhtmlx/dhtmlxWindows/codebase/dhtmlxwindows.js"></script> <script src="dhtmlx/dhtmlxWindows/codebase/ext/dhtmlxwindows_wtb.js"></script> <script src="dhtmlx/dhtmlxToolbar/codebase/dhtmlxcommon.js"></script> <script src="dhtmlx/dhtmlxToolbar/codebase/dhtmlxtoolbar.js"></script> <script src="dhtmlx/dhtmlxWindows/codebase/ext/dhtmlxwindows_wtb.js"></script> <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxToolbar/codebase/skins/dhtmlxtoolbar_dhx_blue.css"> <style type="text/css"> tr.classrow td{ background-color:#ffffbf; } tr.subclassrow td{ background-color:#ffffcc; } td.reqrow{ background-color:#ffe4b5; } td.fmrow{ background-color:#ffcc99; } td.fmcrow { background-color:#FFCCCC; } tr.overrow td{ background-color:#FFCCCC; } .grid_hover td{ background-color:#FFCCCC; } html, body { width: 100%; height: 100%; overflow: hidden; margin: 0px; } </style> <script language="javascript" type="text/javascript"> var subclass_id; var fmeaGrid; var bar; function onBodyLoad(){ subclass_id=document.getElementById('subclass_id').value if(subclass_id!=null){ loadGrid(); } //alert(subclass_id) } function loadGrid() { var dhxLayout = new dhtmlXLayoutObject(document.body, "1C"); bar=dhxLayout.cells("a").attachToolbar(); bar.setIconsPath("dhtmlx/dhtmlxGrid/codebase/imgs/csh_bluebooks/"); bar.loadXML("XML/fmea_toolbar.xml?etc="+new Date().getTime()); //dhxLayout.cells("a").setHeight(10); //dhxLayout.cells("a").fixSize(true, true); fmeaGrid = new dhtmlXGridObject('fmeagrid'); //fmeaGrid = dhxLayout.cells("a").attachGrid(); dhxLayout.cells("a").attachObject('fmeagrid'); dhxLayout.cells("a").setText("FMEA For Project <%=project%><font style='font-weight:normal;font-size:12px; font-style:italic'>( <%=classString%> -> <%=subClassString%> )</font>"); fmeaGrid.setImagePath("dhtmlx/dhtmlxGrid/codebase/imgs/csh_bluebooks/"); fmeaGrid.setDateFormat("%d/%b/%Y"); fmeaGrid.setHeader("Requirement Function,Potential Failure Mode,Potential Effect(s) of Failure,SEV, Potential Cause(s)/Mechanism(s) of Failure, OCC,Current Design / Process Control PREVENTION, Current Design / Process Control DETECTION,DET,SOD, Recommended Action(s),Responsibility,Target Completion Date,Action Taken, Action Results,#cspan,#cspan,#cspan"); fmeaGrid.setInitWidths("200,200,200,50,200,50,115,115,50,50,250,100,100,100,50,50,50,50"); fmeaGrid.attachHeader("#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,SEV2,OCC2,DET2,SOD2"); fmeaGrid.setColTypes("txt,txt,txt,co,txt,co,txt,txt,co,ro,co,txt,dhxCalendar,txt,co,co,co,ro"); fmeaGrid.setColAlign("left,left,left,center,left,center,left,left,center,center,left,left,left,left,center,center,center,center") fmeaGrid.enableEditEvents(false,true,'disable'); //fmeaGrid.setColumnColor("#ffe4b5,#ffcc99,#ffcc99,#ffcc99") //fmeaGrid.enableRowsHover(true,'overrow'); //fmeaGrid.enableRowsHover(true,'grid_hover') fmeaGrid.enableMultiline(true); fmeaGrid.preventIECaching(true); fmeaGrid.attachEvent("onRowSelect",doOnRowSelected); fmeaGrid.attachEvent("onEditCell",doOnCellEdit); fmeaGrid.init(); fmeaGrid.splitAt(2); fmeaGrid.setSkin('light'); // (xp, mt, gray, light, clear, modern) fmeaGrid.loadXML("XML/fmea_tree_gride_new.jsp?project_id="+document.getElementById('project_id').value+"&subclass_id="+document.getElementById('subclass_id').value+"&mydate="+(new Date()).valueOf(),function(){ //bar.hideItem('new_req'); bar.hideItem('new_fm'); bar.hideItem('new_fmc'); bar.hideItem('del_req'); bar.hideItem('del_fm'); bar.hideItem('del_fmc'); }); function doOnRowSelected(){ var reqData=fmeaGrid.getUserData(fmeaGrid.getSelectedId(),'REQ') var fmData=fmeaGrid.getUserData(fmeaGrid.getSelectedId(),'FM') var fmcData=fmeaGrid.getUserData(fmeaGrid.getSelectedId(),'FMC') if(reqData=='Req'){ bar.showItem('new_fm'); bar.showItem('del_req'); bar.hideItem('new_fmc'); bar.hideItem('del_fm'); bar.hideItem('del_fmc'); } if(fmData=='Fm'){ bar.showItem('new_fmc'); bar.showItem('del_fm'); //bar.hideItem('new_req'); bar.hideItem('new_fm'); bar.hideItem('del_req'); bar.hideItem('del_fmc'); } if(fmcData=='Fmc'){ bar.showItem('del_fmc'); //bar.hideItem('new_req'); bar.hideItem('new_fm'); bar.hideItem('new_fmc'); bar.hideItem('del_req'); bar.hideItem('del_fm'); } } function addReqNode() { var z=fmeaGrid.getSelectedId(); var req_id= (new Date()).valueOf(); fmeaGrid.addRow(req_id,['add new requirement here...'],-1); fmeaGrid.cells(req_id,0).setFont("Arial-italic-12px"); fmeaGrid.cells(req_id,0).cell.style.height = "25px"; fmeaGrid.cells(req_id,0).setBgColor("#ffe4b5"); //grid.cells(i,j).cell.style[name]=value fmeaGrid.cells(req_id,1).setDisabled(true); fmeaGrid.cells(req_id,2).setDisabled(true); fmeaGrid.cells(req_id,3).setDisabled(true); fmeaGrid.cells(req_id,4).setDisabled(true); fmeaGrid.cells(req_id,5).setDisabled(true); fmeaGrid.cells(req_id,6).setDisabled(true); fmeaGrid.cells(req_id,7).setDisabled(true); fmeaGrid.cells(req_id,8).setDisabled(true); fmeaGrid.cells(req_id,9).setDisabled(true); fmeaGrid.cells(req_id,10).setDisabled(true); fmeaGrid.cells(req_id,11).setDisabled(true); fmeaGrid.cells(req_id,12).setDisabled(true); fmeaGrid.cells(req_id,13).setDisabled(true); fmeaGrid.cells(req_id,14).setDisabled(true); fmeaGrid.cells(req_id,15).setDisabled(true); fmeaGrid.cells(req_id,16).setDisabled(true); fmeaGrid.cells(req_id,17).setDisabled(true); fmeaGrid.setUserData(req_id, 'REQ', 'Req') fmeaGrid.cells(req_id,1).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,2).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,3).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,4).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,5).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,6).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,7).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,8).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,9).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,10).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,11).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,12).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,13).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,14).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,15).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,16).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(req_id,17).cell.style.border = "1px #FFFFFF solid" //fmeaGrid.openItem(req_id) ; } /*mygrid.moveRowDown(rowId) mygrid.moveRowUp(rowId)*/ function addFmNode() { //alert(fmeaGrid.getSelectedId()) var fm_id=(new Date()).valueOf(); fmeaGrid.addRow(fm_id,['','add new fm here...','add effects here',''],fmeaGrid.getRowIndex(fmeaGrid.getSelectedId())+1); fmeaGrid.cells(fm_id,1).setFont("Arial-italic-12px"); fmeaGrid.cells(fm_id,2).setFont("Arial-italic-12px"); fmeaGrid.cells(fm_id,0).cell.style.height = "25px"; fmeaGrid.cells(fm_id,1).cell.style.height = "25px"; fmeaGrid.cells(fm_id,2).cell.style.height = "25px"; fmeaGrid.cells(fm_id,0).setDisabled(true); fmeaGrid.cells(fm_id,0).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,1).setBgColor("#ffcc99"); fmeaGrid.cells(fm_id,2).setBgColor("#ffcc99"); fmeaGrid.cells(fm_id,3).setBgColor("#ffcc99"); fmeaGrid.cells(fm_id,4).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,5).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,6).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,7).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,8).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,9).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,10).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,11).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,12).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,13).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,14).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,15).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,16).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,17).setBgColor("#ffffff"); fmeaGrid.cells(fm_id,0).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,4).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,5).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,6).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,7).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,8).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,9).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,10).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,11).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,12).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,13).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,14).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,15).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,16).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fm_id,17).cell.style.border = "1px #FFFFFF solid" var sev = fmeaGrid.getCombo(3); sev.put("9","9"); sev.put("7","7"); sev.put("5","5"); sev.put("3","3"); sev.put("1","1"); fmeaGrid.cells(fm_id,0).setDisabled(true); fmeaGrid.cells(fm_id,4).setDisabled(true); fmeaGrid.cells(fm_id,5).setDisabled(true); fmeaGrid.cells(fm_id,6).setDisabled(true); fmeaGrid.cells(fm_id,7).setDisabled(true); fmeaGrid.cells(fm_id,8).setDisabled(true); fmeaGrid.cells(fm_id,9).setDisabled(true); fmeaGrid.cells(fm_id,10).setDisabled(true); fmeaGrid.cells(fm_id,11).setDisabled(true); fmeaGrid.cells(fm_id,12).setDisabled(true); fmeaGrid.cells(fm_id,13).setDisabled(true); fmeaGrid.cells(fm_id,14).setDisabled(true); fmeaGrid.cells(fm_id,15).setDisabled(true); fmeaGrid.cells(fm_id,16).setDisabled(true); fmeaGrid.cells(fm_id,17).setDisabled(true); //fmeaGrid.openItem(fm_id) ; fmeaGrid.setUserData(fm_id, 'FM', 'Fm') return true; } function addFmcNode() { var fmc_id=(new Date()).valueOf(); fmeaGrid.addRow(fmc_id,['','','','','add fmc here...','','add prevention','add detection','','','select recommended action','','','','','','','-'],fmeaGrid.getRowIndex(fmeaGrid.getSelectedId())+1); fmeaGrid.cells(fmc_id,0).cell.style.height = "25px"; fmeaGrid.cells(fmc_id,1).cell.style.height = "25px"; fmeaGrid.cells(fmc_id,2).cell.style.height = "25px"; fmeaGrid.cells(fmc_id,3).cell.style.height = "25px"; fmeaGrid.cells(fmc_id,4).cell.style.height = "25px"; fmeaGrid.cells(fmc_id,4).setFont("Arial-italic-11px"); fmeaGrid.cells(fmc_id,6).setFont("Arial-italic-11px"); fmeaGrid.cells(fmc_id,7).setFont("Arial-italic-11px"); fmeaGrid.cells(fmc_id,0).setDisabled(true); fmeaGrid.cells(fmc_id,1).setDisabled(true); fmeaGrid.cells(fmc_id,2).setDisabled(true); fmeaGrid.cells(fmc_id,3).setDisabled(true); fmeaGrid.cells(fmc_id,0).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fmc_id,1).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fmc_id,2).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fmc_id,3).cell.style.border = "1px #FFFFFF solid" fmeaGrid.cells(fmc_id,4).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,5).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,6).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,7).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,8).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,9).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,10).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,11).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,12).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,13).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,14).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,15).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,16).setBgColor("#FFCCCC"); fmeaGrid.cells(fmc_id,17).setBgColor("#FFCCCC"); var occ = fmeaGrid.getCombo(5); occ.put("9","9"); occ.put("7","7"); occ.put("5","5"); occ.put("3","3"); occ.put("1","1"); var det = fmeaGrid.getCombo(8); det.put("9","9"); det.put("7","7"); det.put("5","5"); det.put("3","3"); det.put("1","1"); var ra = fmeaGrid.getCombo(10); ra.put("Tolerance Stack","Tolerance Stack"); ra.put("FEA","FEA"); ra.put("CFD Analysis","CFD Analysis"); ra.put("Experimental Testing","Experimental Testing"); ra.put("Functional Relationship","Functional Relationship"); ra.put("Mechanical Testing & functional relationship","Mechanical Testing & functional relationship"); ra.put("Hand Calc","Hand Calc"); var sev2 = fmeaGrid.getCombo(14); sev2.put("9","9"); sev2.put("7","7"); sev2.put("5","5"); sev2.put("3","3"); sev2.put("1","1"); var occ2 = fmeaGrid.getCombo(15); occ2.put("9","9"); occ2.put("7","7"); occ2.put("5","5"); occ2.put("3","3"); occ2.put("1","1"); var det2 = fmeaGrid.getCombo(16); det2.put("9","9"); det2.put("7","7"); det2.put("5","5"); det2.put("3","3"); det2.put("1","1"); fmeaGrid.setUserData(fmc_id, 'FMC', 'Fmc') } bar.attachEvent("onClick", function(id) { //writeLog("<b>onClick event</b> button("+id+") was clicked"); if(id=='new_req'){ addReqNode() } if(id=='new_fm'){ addFmNode() } if(id=='new_fmc'){ addFmcNode() } if(id=='del_req' || id=='del_fm' || id=='del_fmc'){ deleteRow() } /*if(id=='move_up'){ fmeaGrid.moveRowUp(fmeaGrid.getSelectedId()) } if(id=='move_down'){ fmeaGrid.moveRowDown(fmeaGrid.getSelectedId()) }*/ }); var myDataProcessor = new dataProcessor("XML/inserReq.jsp"); myDataProcessor.setUpdateMode("cell"); myDataProcessor.setTransactionMode("GET"); //myDataProcessor.enableDebug(true) myDataProcessor.init(fmeaGrid); myDataProcessor.setOnAfterUpdate(myUpdate); function myUpdate(){ fmeaGrid.updateFromXML("XML/fmea_tree_gride_new.jsp?project_id="+document.getElementById('project_id').value+"&subclass_id="+document.getElementById('subclass_id').value+"&mydate="+(new Date()).valueOf()); } myDataProcessor.setOnBeforeUpdateHandler(function(id, mode){ var reqData=fmeaGrid.getUserData(id,'REQ') var fmData=fmeaGrid.getUserData(id,'FM') var fmcData=fmeaGrid.getUserData(id,'FMC') if(reqData=='Req'){ if (mode=="inserted"){ //alert("In Req") if(fmeaGrid.cells(id,0).getValue()=="add new requirement here..." || fmeaGrid.cells(id,0).getValue()==""){ alert("Please add Requirement Here") //fmeaGrid.cells(id,0).cell.style.border = "1px solid red" return false; } else{ //fmeaGrid.cells(id,0).cell.style.border = "1px #b0e0e6 solid"; myDataProcessor.serverProcessor="XML/insertReq.jsp?project_id="+document.getElementById('project_id').value+"&mydate="+(new Date()).valueOf()+"&user="+document.getElementById('user').value+"&subclass_id="+document.getElementById('subclass_id').value; return true; } } else{ if(fmeaGrid.cells(id,0).getValue()=="add new requirement here..." || fmeaGrid.cells(id,0).getValue()==""){ alert("Please add Requirement Here") //fmeaGrid.cells(id,0).cell.style.border = "1px solid red" return false; } else{ //alert(mode) //fmeaGrid.cells(id,0).cell.style.border = "1px #000000 solid" myDataProcessor.serverProcessor="XML/editReq.jsp?user="+document.getElementById('user').value+"&mode="+mode; return true; } } } if (fmData=='Fm'){ var parRowId=fmeaGrid.getRowId(fmeaGrid.getRowIndex(id)-1) if (mode=="inserted"){ if(fmeaGrid.cells(id,1).getValue()=="add new fm here..." || fmeaGrid.cells(id,1).getValue()==""){ //alert("Please add FM Here") //fmeaGrid.cells(id,1).cell.style.border = "1px solid red" return false; } else if(fmeaGrid.cells(id,2).getValue()=="add effects here" || fmeaGrid.cells(id,2).getValue()==""){ //alert("Please add FME Here") //fmeaGrid.cells(id,2).cell.style.border = "1px solid red" return false; } else if(fmeaGrid.cells(id,3).getValue()=="-" || fmeaGrid.cells(id,3).getValue()==""){ //alert("Please add Severity Here") //fmeaGrid.cells(id,3).cell.style.border = "1px solid red" return false; } else{ /*fmeaGrid.cells(id,1).cell.style.border = "1px #b0e0e6 solid" fmeaGrid.cells(id,2).cell.style.border = "1px #b0e0e6 solid" fmeaGrid.cells(id,3).cell.style.border = "1px #b0e0e6 solid"*/ myDataProcessor.serverProcessor="XML/insertFM.jsp?user="+document.getElementById('user').value+"&parRowId="+parRowId; return true; } } else{ if(fmeaGrid.cells(id,1).getValue()=="add new fm here..." || fmeaGrid.cells(id,1).getValue()==""){ alert("Please add FM Here") //fmeaGrid.cells(id,1).cell.style.border = "1px solid red" return false; } else if(fmeaGrid.cells(id,2).getValue()=="add effects here" || fmeaGrid.cells(id,2).getValue()==""){ alert("Please add FME Here") //fmeaGrid.cells(id,2).cell.style.border = "1px solid red" return false; } else if(fmeaGrid.cells(id,3).getValue()=="-" || fmeaGrid.cells(id,3).getValue()==""){ alert("Please add SEV Here") //fmeaGrid.cells(id,3).cell.style.border = "1px solid red" return false; } else{ /*fmeaGrid.cells(id,1).cell.style.border = "1px #b0e0e6 solid" fmeaGrid.cells(id,2).cell.style.border = "1px #b0e0e6 solid" fmeaGrid.cells(id,3).cell.style.border = "1px #b0e0e6 solid"*/ myDataProcessor.serverProcessor="XML/editFM.jsp?user="+document.getElementById('user').value+"&mode="+mode; return true; } } } if (fmcData=='Fmc'){ var parRowId=fmeaGrid.getRowId(fmeaGrid.getRowIndex(id)-1) if (mode=="inserted"){ if(fmeaGrid.cells(id,4).getValue()=="add fmc here..." || fmeaGrid.cells(id,4).getValue()==""){ alert("Please add FMC Here") //fmeaGrid.cells(id,4).cell.style.border = "1px solid red" return false; }else{ //fmeaGrid.cells(id,4).cell.style.border = "1px #b0e0e6 solid" myDataProcessor.serverProcessor="XML/insertFMC.jsp?user="+document.getElementById('user').value+"&parRowId="+parRowId; return true; } } else{ if(fmeaGrid.cells(id,4).getValue()=="add fmc here..." || fmeaGrid.cells(id,4).getValue()==""){ alert("Please add FMC Here") //fmeaGrid.cells(id,4).cell.style.border = "1px solid red" return false; }else{ //fmeaGrid.cells(id,4).cell.style.border = "1px #b0e0e6 solid" myDataProcessor.serverProcessor="XML/editFMC.jsp?user="+document.getElementById('user').value+"&mode="+mode; return true; } } } }); }//Page Load Function End function deleteRow(){ var reqData=fmeaGrid.getUserData(fmeaGrid.getSelectedId(),'REQ') var fmData=fmeaGrid.getUserData(fmeaGrid.getSelectedId(),'FM') var fmcData=fmeaGrid.getUserData(fmeaGrid.getSelectedId(),'FMC') //alert(reqData+"---"+fmData+"---"+fmcData) if(reqData=='Req'){ if(confirm('Do you really want to delete this Requirement?\n It will delete its Failure Modes and Causes')){ fmeaGrid.deleteSelectedItem() //fmeaGrid.clearAll("enable"); window.location.reload() return true } } if(fmData=='Fm'){ if(confirm('Do you really want to delete this Failure Mode?\n It will delete its Failure Mode Causes')){ fmeaGrid.deleteSelectedItem() //fmeaGrid.clearAll("enable"); window.location.reload() return true } } if(fmcData=='Fmc'){ if(confirm('Do you really want to delete this Failure Mode Cause?')){ fmeaGrid.deleteSelectedItem() //fmeaGrid.clearAll("enable"); window.location.reload() return true } } } function doOnCellEdit(stage,rowId,cellInd){ //alert("Stage=="+stage) var reqData=fmeaGrid.getUserData(rowId,'REQ') var fmData=fmeaGrid.getUserData(rowId,'FM') var fmcData=fmeaGrid.getUserData(rowId,'FMC') if(reqData=='Req'){ var firstCellValue=fmeaGrid.cells(rowId,0).getValue(); if (firstCellValue=="add new requirement here..."){ fmeaGrid.cells(rowId,0).setValue(""); } } if(fmData=='Fm'){ if (fmeaGrid.cells(rowId,1).getValue()=="add new fm here..."){ fmeaGrid.cells(rowId,1).setValue(""); } else if (fmeaGrid.cells(rowId,2).getValue()=="add effects here"){ fmeaGrid.cells(rowId,2).setValue(""); } } if(fmcData=='Fmc'){ if (fmeaGrid.cells(rowId,4).getValue()=="add fmc here..."){ fmeaGrid.cells(rowId,4).setValue(""); //return false; } else if(fmeaGrid.cells(rowId,6).getValue()=="add prevention"){ fmeaGrid.cells(rowId,6).setValue(""); //return false; } else if(fmeaGrid.cells(rowId,7).getValue()=="add detection"){ fmeaGrid.cells(rowId,7).setValue(""); //return false; } else if(fmeaGrid.cells(rowId,10).getValue()=="select recommended action"){ fmeaGrid.cells(rowId,10).setValue(""); //return false; } } &nbs Answer posted by Support on Jan 22, 2009 05:27 Such problem occurs when grid not able to parse current date in the cell ( it fallback to zero date ) >> fmeaGrid.setDateFormat("%d/%b/%Y"); Accepts month names as ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] |