CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Date picker format issue with dd-mmm-yyyy or d-M-Y

by bob9999 » 16 Feb 2019 01:29

I have a SQL Server that I have a query loaded and a date picker attached to the date/time column in the dataset. I am using GridDataSetProvider.

When I set date picker format to dd-mm-yyyy and the dephi new format to same all works perfectly and I can chose a date and save to database with cell edit. As soon as I change to what I really want of dd-mmm-yyyy then date picker shows the right format when selected but then I receive an error "12-Feb-2019 Expense Date: Please, enter valid date value - d-M-Y". The date is in the correct format so what is the issue?

I even tried to change the DateFmt to d-M-Y and that still does not work. If I manually change the short date name to a number, then all saves fine and I just refresh the grid and my short month name appears again.

When I use your date picker in another part of my application I have to convert the format before I try to save to database since SQL Server cannot use 12-Feb-2019 directly. I figured that the datepicker in the grid would take care of that for me but it looks like it does not like d-M-Y format.

I am going to try to catch the event to change the date just before database submit but it looks like something is not working as expected since the error message has the right format in it and seems to just not recognize "M" and only "m" in that format.

Cheers.
bob9999
 
Posts: 110
Joined: 18 Jan 2019 17:32

by bob9999 » 20 Feb 2019 21:30

As I started to get into the data layer of the grid, I could tell I was getting into a real complication and reverse engineering to learn here which I really have no time for right now. I am 99% sure there is a bug in here anyway with this sort of date format. What I did instead was change this over to a new character column in the date format I want and then turn off the local date edit check in the grid and just take over at the database layer in my update and insert triggers.

So now the application binds to the new date character representation and the user can enter whatever he or she wishes in the grid and I test at the database if a date and if OK, then update my datetime column myself. If the test fails then I throw an exception that the application sees and displays my custom database message so then there is no techie stuff shown to the user for him or her to then action.

Cheers!
bob9999
 
Posts: 110
Joined: 18 Jan 2019 17:32

by Alexander Bulei » 22 Feb 2019 16:02

Hi bob9999,

There is no bugs...just doesn't support that format.
if you want handle it, you need use the available events and transform the value to valid DB field type (format).

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by bob9999 » 24 Feb 2019 07:28

Thanks Alexander. I figured there was something missing there and I went through many events trying to override the value to the database (trapped many events in debugger and inspected parameter values) but it is hidden somewhere in there and I ran out of time. That is why I just went with the trigger method and just let the data layer take care of everything. Character format seems to be more native to the datepicker so then all fit in the groove.

Is there any way for the grid display to just be updated for the one selected row? In the database trigger I also perform calculations for the grid to display but I have to refresh the whole grid in order to get the changed data to display. I am used to other data aware controls that just auto render when underlying data is updated. So the mechanism desired is to post the updated cell and then refresh all the row values.

Cheers!
bob9999
 
Posts: 110
Joined: 18 Jan 2019 17:32


Return to JQGrid

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.