Date Convertion Error for Editor

Date Convertion Error for Editor

RahmiIneviRahmiInevi Posts: 19Questions: 5Answers: 0

Hello, I'm testing Dt Editor,
but Im Inline Edit or Bubble Edit for Editing a Date,
Date is wrong convertion for edit.

Data as (Date) : "2018-11-05T00:00:00"
Column Properties

, type: "datetime"
,dateFormat: "dd.mm.YYYY"
,Format: "dd.mm.YYYY"
, render: function (data, type, row, meta) {
return moment(row.isegiristarihi).format("DD/MM/YYYY");
}

Im save a screen for understand

Answers

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    There is no dateFormat or Format option for the columns array. Nor is there a datetime type in DataTables.

    Drop those three lines and try just the render function.

    If that doesn't resolve the issue, please link to a test case showing the issue.

    Allan

  • RahmiIneviRahmiInevi Posts: 19Questions: 5Answers: 0

    Dear allan,

    Thanks for answer,

    I'm using SQL Server and ClientSide DataTables Editor (Trial)

    I will buy DataTables Editor, now using Trial version.

    I send image related to your DataTables Editor Plugins for DatePicker problem.

    I'm using Render function on DataTables but I change Date with DatePicker on Editor Plugins.

    I get data from SQL Server and Returning with Json on ASPNET MVC .

    Select *** SQ Server -> MVC -> Json -> ClientSide : ajax (I need this data) and Create Editor and DataTables

  • RahmiIneviRahmiInevi Posts: 19Questions: 5Answers: 0

    Date String is "2018-11-05T00:00:00" in Json Result

  • tangerinetangerine Posts: 3,348Questions: 36Answers: 394

    As Allan said, " please link to a test case showing the issue."

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    Does the date get rendered as expected in the DataTable?

    It really would be helpful to be able to see the page so I can debug it directly.

    Allan

  • RahmiIneviRahmiInevi Posts: 19Questions: 5Answers: 0
    edited April 2019

    Hello Allan,

    I created a Test page for you can see the error,

    personel.orkabulut.com/Public/Test

    Please continiue to the first alert message.

    The problem is Selected Wrong Date on DatePicker Dialog with Column Date Data

    Site.js = vm.Test()
    OrkaTools.js -> DataTable.Olustur()

    Thank you.

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    Okay - I'm with you now. Thanks!

    So the problem is that Editor edits the under laying data (in this case an ISO8601 time stamp) - which is why you see that format when you click on a row. Editor doesn't have a formatter option like DataTables to re-render data.

    There are two options:

    1. Modify the JSON return from the server to be in the format you want for display (this is what I generally recommend).
    2. Use xhr to loop over the data retrieved from the server and convert the data before it is used by DataTables.

    Allan

  • RahmiIneviRahmiInevi Posts: 19Questions: 5Answers: 0

    Hello Allan,
    Thanks...

    Can I use the xhr option for ArrayCollections?

    I must get data with Angularjs Http Services and I will Set a Property as Array.
    I will use this property to Page with AngularJS repeat.

    I would appreciate if got you share an example.

  • RahmiIneviRahmiInevi Posts: 19Questions: 5Answers: 0
    edited April 2019

    Hello Allan,

    Thanks for help :) .

    Solved...

    For JsonResult on ASP.NET MVC

            var list = JsonConvert.SerializeObject(Veri, Formatting.None, new JsonSerializerSettings()
            {
                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore,
                DateFormatHandling = DateFormatHandling.MicrosoftDateFormat,
                DateFormatString = "dd/MM/yyyy"
    
    
            });
    

    Field Set:

    [
    {
    data: "isegiristarihi"
    , name: "isegiristarihi"
    , title: "İşe Giriş"
    , type: "datetime"
    , dateFormat: "dd.mm.Y"
    , format: 'DD/MM/YYYY'
    , width: 120
    , className: 'dt-body-center text-center'
    },
    ]

This discussion has been closed.