Categories | Question details Back To List | ||
dhxCalendar Hi, i am using the dhxCalendar component and it is a great component. except i am having the following problem. i am using the oncelledit event and the event passes rowid,cellid,newvalue,oldvalue in this method i need to compare the newvalue and oldvalue if(newvalue != oldvalue)] { // run this code } it hasnt been working properly so i tried to alert both values and i got this: newvalue = 24/12/2007 oldvalue = Tue Feb 12 2008 14:31:25 GMT +0000 (GMT Standard Time) this happens even of i know the old value was 12/12/2007 for example. so at the moment it is impossible for me to compare the oldvalue and newvalue. how do i change this to get it to give me the oldvalue as it was in field. thanks richard Answer posted by Support on Feb 12, 2008 07:43 Problem confirmed, it caused by some specific of onEditCell event, the "old value" parameter contains real old value, but it provided not as string, but as Date object, so it still possible to compare them as oldvalue = oldvalue.getDate()+"/"+oldvalue.getMonth()+"/"+oldvalue.getYear(); if(newvalue != oldvalue) .... Answer posted by Richard White on Feb 12, 2008 07:54 Hi, thanks for your prompt reply. i have noticed a couple of additional problems with the code you gave me. i wrote the code exactly how you gave it and it outputted it as 21/1/108 on a date that was set to 21/02/2008 - so its not quite getting it out correctly also, if the dhxCalendar cell is empty then i select a date, it still passes over a date - it looks like it is passing over the date and time now instead of passing an empty string in the oldvalue parameter thanks very much richard Answer posted by Support on Feb 12, 2008 10:14 >>so its not quite getting it out correctly My code is not fully correct, because getMonth returns zero based value , while in human readable format it is must be 1-based >>it looks like it is passing over the date and time now instead the code of calendar sets current date as default one, when no date was specified Actually, if you need to check - is cell value was changed, you can use grid.cells(i,j).wasChanged(); Answer posted by richard white on Feb 12, 2008 11:17 hi, thanks again for your quick reply >>it looks like it is passing over the date and time now instead >>the code of calendar sets current date as default one, when no date was specified is there anyway i can get it to either give me the that it was changed to or pass an empty string and not set a default as th current date >>Actually, if you need to check - is cell value was changed, you can use >>grid.cells(i,j).wasChanged(); thanks but i really need to be able to run checks on the new and old values, and need it an empty string to be passed this was working fine when i was using the calendar cell type but i needed this new calendar cell type due to being able to change the years quickly. i would really appreciate if you could tell me how to change the code so that it doesnt set a default date of now if the cell is empty thanks Answer posted by Support on Feb 13, 2008 04:49 Please try to use attached js file instead of original one - it must resolve problem. Attachments (1) Answer posted on Feb 26, 2008 09:08 thanks that is now working fine richard |