Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
Setting input date format in grid
posted

Hey,

I am attempting to get a grid to allow for dates to be editted, for the column I have the following code:

column.For(x => x.StartDate).HeaderText("Start Date").Width("").DataType("date").Format("dd/MM/yyyy");

For the column settings I have this code:

cs.ColumnSetting().ColumnKey("StartDate").EditorType(ColumnEditorType.DatePicker).ReadOnly(false);

When i perform an edit the editor appears to fire back a date in the format of "MM/dd/yyyy" to the grid which is causing some very strange errors to occur.

I think the solution may be related to using DateEditorOptions in the column settings however I was unable to find any examples of this online and there appears to be very little documentation on this related to my current scenario.

Any assistance would be greatly appreciated, thanks

Parents
  • 17590
    Offline posted

    Hello Callum,

    I created a small sample with igGrid where I have date column ("Released Date") which I format as per your suggestion:

      col.For(c => c.ReleaseDate).HeaderText("ReleaseDate").Format("dd/MM/yyyy");

    I added this column to the Updating columnSettings collection.

     cs.ColumnSetting().ColumnKey("ReleaseDate").EditorType(ColumnEditorType.DatePicker).ReadOnly(false);

    On my side the format was correctly set in both edit and non-edit mode.

    Can you please run my sample and let me know how it behaves on your side. If this not an accurate demonstration of what you are trying to achieve please feel free to modify it in order to reproduce the issue and send it back to me for further investigation.

    Additionally, I believe you will find the following resources helpful:

    Grid Basic Editing Sample

    Formatting Dates, Numbers and Strings

    format option

    Please feel free to contact me if you need any further assistance with this matter.

    igGridFormatDate.zip
Reply Children