Categories | Question details Back To List | ||||||||||||||
dataprocessor and dhxcalendar - change data before sending to JSP We are using dhtmlXDataProcessor v.1.0 build 71114. to send updates to JSP. We use v1.5 for rest of grid js files. The grid we have, uses dhxCalendar. After adding a row, the data is sent to JSP using dataprocessor. But, the date is sent in various formats depending on time zone like Mon May 12 00:00:00 UTC+0530 2008, Mon Jul 3 00:00:00 EDT 2000 When this parameter goes to JSP, the + in Mon May 12 00:00:00 UTC+0530 2008 is replaced by a space and we are unable to use this date. Can you tell how to modify the date to dd-MMM-yyyy format before sending to JSP. I tried to use setOnBeforeUpdateHandler, but none of the added rows are sent to JSP. Also, when I try to sort column with type dhxcalendar, I get js error. When using dhxCalendar, if I double click on date, the calendar does not close until I mouse click somewhere else on the page. Below is the code used. Please advise. <script language="javascript" type="text/javascript" src="widgets/dhtmlxgrid/js/dhtmlXGrid/dhtmlXCommon.js"></script> <script language="javascript" type="text/javascript" src="widgets/dhtmlxgrid/js/dhtmlXGrid/dhtmlXGrid.js"></script> <script language="javascript" type="text/javascript" src="widgets/dhtmlxgrid/js/dhtmlXGrid/dhtmlXGrid_dload.js"></script> <script language="javascript" type="text/javascript" src="widgets/dhtmlxgrid/js/dhtmlXGrid/dhtmlXGridCell.js"></script> <script language="javascript" type="text/javascript" src="widgets/dhtmlxgrid/js/dhtmlXGrid/dhtmlXGrid_excell_link.js"></script> <script language="javascript" type="text/javascript" src="widgets/dhtmlxgrid/js/dhtmlXGrid/dhtmlXGrid_math.js"></script> <script language="javascript" type="text/javascript" src="widgets/dhtmlxgrid/js/dhtmlXGrid/dhtmlXDataProcessor.js"></script> <script language="javascript" type="text/javascript" src="widgets/dhtmlxcalendar/js/dhtmlxcalendar.js"></script> <script language="javascript" type="text/javascript" src="widgets/dhtmlxcalendar/js/dhtmlxgrid_excell_calendar.js"></script> <script language="javascript" type="text/javascript" src="widgets/dhtmlxcalendar/js/dhtmlXGrid_excell_dhxcalendar.js"></script> <script language="javascript" type="text/javascript" src="widgets/dhtmlxgrid/js/dhtmlXGrid/dhtmlXGrid_srnd.js"></script> debtgrid = new dhtmlXGridObject('gridDebtResult'); debtgrid.setImagePath("widgets/dhtmlxgrid/images/dhtmlXGrid/"); debtgrid.setHeader("<div id='hh1'>Debt</div>,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan"); debtgrid.attachHeader("<div id='hh4'>Fiscal</div>,<div id='hh2'>Effective</div>,<div id='hh2'>Expiry</div>,<div id='hh2'>Source</div>,<div id='hh2'>ShortTerm</div>,<div id='hh2'>LongTerm</div>,<div id='hh2'>Total</div>,<div id='hh2'>Notes</div>,<div id='hh2'>Mod By</div>,<div id='hh2'>Mod When</div>"); debtgrid.setInitWidths("100,100,100,100,80,80,80,*,60,100"); debtgrid.setColAlign("center,center,center,left,right,right,right,left,left,center"); debtgrid.setColTypes("dhxCalendar,dhxCalendar,ro,ed,edn[=c4],edn[=c5],edn[=c6],ed,ro,ro"); debtgrid.setColSorting("date,date,str,str,int,int,int,str,str,date"); debtgrid.setScrollbarWidthCorrection(); debtgrid.setDateFormat("%d-%b-%Y"); debtgrid.setNumberFormat("0,000.00", 4); debtgrid.setNumberFormat("0,000.00", 5); debtgrid.setNumberFormat("0,000.00", 6); debtgrid.attachEvent("onEditCell",editSource); debtgrid.setSkin("boa"); debtgrid.init(); debtgrid.setOnLoadingEnd(OnDebtGridLoad); debtgrid.enableAlterCss("odd_boa","even_boa"); //debtgrid.loadXML("myPage.htm?method=loadDebt&<%=MyController.ISSUER_ID_PARAM%>=" + ${issuerId}); /*@ Data Processor for Debt*/ debtProcessor = new dataProcessor("debtform.htm"); debtProcessor.setVerificator(0); debtProcessor.setVerificator(1, function(value, colName){return checkIfUniqueDate(debtgrid, value, 1, colName)}); debtProcessor.setVerificator(4, checkIfValidNumber); debtProcessor.setVerificator(5, checkIfValidNumber); debtProcessor.setUpdateMode("off"); debtProcessor.setTransactionMode("POST"); //debtProcessor.setOnBeforeUpdateHandler(onBeforeDebtUpdate); debtProcessor.setOnAfterUpdate(onAfterDebtUpdate); debtProcessor.init(debtgrid); function onBeforeDebtUpdate(rowId){ alert("jsp: " + debtgrid.cells(rowId,0).getValue()); var fiscalDate = new Date(debtgrid.cells(rowId,0).getValue()); var effectiveDate = new Date(debtgrid.cells(rowId,1).getValue()); debtgrid.cells(rowId,0).setValue(fiscalDate.getDate()+ "-" + fiscalDate.getMonth()+1 + "-" + fiscalDate.getYear()); debtgrid.cells(rowId,1).setValue(effectiveDate.getDate()+ "-" + effectiveDate.getMonth()+1 + "-" + effectiveDate.getYear()); } Answer posted by Support on May 19, 2008 05:26 >>Can you tell how to modify the date to dd-MMM-yyyy format before sending to JSP. The issue was fixed in latest code, please try to use attached js file instead of original one, with it you will receive data in same format as it rendered in the grid. >>Also, when I try to sort column with type dhxcalendar, I get js error. Please try to use attached dhtmlxcalendar.js instead of original one ( which had problem with %b format option )
Attachments (2)
|