This is a migrated thread and some comments may be shown as answers.

Datepicker in Grid column & "dirty data"

5 Answers 128 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
FinallyInSeattle
Top achievements
Rank 1
FinallyInSeattle asked on 07 Oct 2011, 12:02 AM
Repro steps:
  1. Go to your "Batch Editing" sample.
  2. Open up the datepicker calendar for one of the "Last supply" values.
  3. Close the calendar WITHOUT changing the date.

The cell is marked with the dirty indicator even though we didn't change the value.  What can be done to avoid this?

Thanks in advance!

5 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 07 Oct 2011, 04:22 PM
Hello,

 
Unfortunately, this behavior is caused by different time zones. Check this screen-cast which shows what date is returned from the server in online demo and the date returned from local server. The problem is caused by the way how the JavaScriptSerializer to serializes the DateTime ( /Date(milliseconds)/ ). Thus the information for the time zones is lost and the date created on the client is with different hours.

What I can suggest you is to use server binding and editing.

Best regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
FinallyInSeattle
Top achievements
Rank 1
answered on 07 Oct 2011, 05:02 PM
Thanks Georgi!  Our grid that has some date entry fields (date, not time) needs to be configured for Batch Editing just due to the editing behaviors we need.  Is our only choice not to use a datepicker control?  Can we bypass the logic that detects dirty data for certain columns? 

Also, if we have a page that contains two grids (not master/detail) plus other fields that will have ALL its data saved with a single Save button, can we do server binding/editing on one and batch editing on the other?
0
Georgi Krustev
Telerik team
answered on 11 Oct 2011, 12:30 PM
Hello,

The problem with the time zones is not related with the DatePicker UI component. The problem, as I mentioned, is related with Date object and JavaScriptSerializer itself. The safest way to overcome this issue is to use server editing. 

Unfortunately, the logic which puts the "dirty" flag cannot be stopped only for a specific columns. 
 
Different grids can have different way of binding/editing. One can have server binding/editing and other can have Ajax binding/editing. Please note that the grid with server binding/editing will cause the page to reload, so any changes made in the grid, which uses Ajax binding/editing will be lost if they are not saved before that.

Regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
FinallyInSeattle
Top achievements
Rank 1
answered on 14 Oct 2011, 12:39 AM
Is there a way to remove the dirty indicator?  I tried the following code in the onSave that I found on the forum, but it didn't appear to work:

function GridProducts_onSave(e) {
    $(e.cell).find(".t-dirty").remove();
}

Thanks in advance!
0
Georgi Krustev
Telerik team
answered on 17 Oct 2011, 02:01 PM
Hello Finallyinseattle,

 
You can achieve your goal with the following code snippet:

function Grid_onSave(e) {
            setTimeout(function() {
                $(e.cell).find(".t-dirty").remove();
            });
        }


Kind regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
FinallyInSeattle
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
FinallyInSeattle
Top achievements
Rank 1
Share this question
or