Editor use internal datetime definition

Editor use internal datetime definition

LapointeLapointe Posts: 430Questions: 81Answers: 4

Hi

I thought dataTables.dateTime.js was used for both searchBuilder, edito and... but I see editor use internal datetime (line 7955)

In future will editor use dataTables.dateTime.js ?

else https://datatables.net/reference/api/DateTime.use() throw 404

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Editor 2 uses the DateTime library, while Editor 1 had it still build into Editor.

    There will be a DateTime reference inside Editor 2 as it needs to declare the field type, but all the UI display of the control is done by the new DateTime library.

    Allan

  • LapointeLapointe Posts: 430Questions: 81Answers: 4
    edited April 2021

    https://editor.datatables.net/download/2.0.0
    ...
    Finally, if you use the datetime field type, please note that we have split the date / time input picker into its own library. To use datetime with Editor 2, you must now also include the new DateTime library. This was done to increase reusability of the library - e.g. it is also used in our SearchBuilder extension for DataTables.
    ....

    How to ?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Best option is to use the download builder.

    Allan

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Hi @allan
    I do use it and set dataTables.dateTime.js link in my dev

    But editor has it's one definition for dateTime picker
    In fact this question is because I use a 'custom (not yet, just a scratch set to do)' button to reset dataTime field content when keyInput: false for control (I did suggest this option some time before) as modifying the structure as

        var structure = $(
            '<div class="'+classPrefix+'">'+
                '<div class="'+classPrefix+'-date">'+
                    '<div class="'+classPrefix+'-title">'+
    //RB
                        '<div class="'+classPrefix+'-iconClear" ' +
                            'style="height: 10px; width: 10px; position: absolute; top: 12px; left: 0px; ' +
                                '-ms-transform: rotate(90deg); -webkit-transform: rotate(90deg); transform: rotate(90deg);">'+
                            '<button></button>'+
                        '</div>'+
    //RB
                        '<div class="'+classPrefix+'-iconLeft">'+
    ....
    

    to allow setnull to dateTimePicker

    So if I modify the dataTables.dateTime.js, this have no effect to editor datatime picker...

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Sorry... I'll have a look to current version used internally... I think there is some mistake in... my dev

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Yep

    editor 2.0.1 line 6948 :
    Editor.DateTime = DataTable.DateTime
    so I set structure as shown in previous post in dateTime module, but no effect

    I find in searchBuilder 1.0.1 DateTime def at line 66... so it is this def that is used in my case

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    hi @allan

    Work fine if I call js in this order... because def for dateTime in searchBuilder

        <script type='text/javascript' language='javascript' src='/js/dataTables.searchBuilder.js'></script>
    
        <script type='text/javascript' language='javascript' src='/js/dataTables.dateTime.js'></script>
    

    Do you mean seachBuilder will be updated soon (and with order for array type select list values) ?
    Regards

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    It looks like we've got an error in SearchBuilder - you are right the DateTime code is still there and it shouldn't be!

    We'll get this fixed in short order.

    Allan

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Tks

    For searchbuilder 1.0.1, I found something starnge at line 2190 :

                    if (that.s.type === 'array' || that.s.type === 'string' || that.s.type === 'num' || that.s.type === 'html' || that.s.type === 'html-num') {
                        if ($(a).val() < $(b).val()) {
                            return -1;
                        }
                        else if ($(a).val() < $(b).val()) {
                            return 1;
                        }
                        else {
                            return 0;
                        }
                    }
    

    I mean result is strange, because comparision is the same 2 times, not ?

    Bob

  • sandysandy Posts: 913Questions: 0Answers: 236
    Answer ✓

    Hi @Lapointe ,

    That should be the issue with datetime being embedded into SearchBuilder fixed now. This will be available in the next SearchBuilder release which we hope will be in the next few weeks. Until then you can access the fix from the nightly builds.

    Thanks,
    Sandy

    ps. Just a note to say that the last comment here on the sorting was resolved in this post.

This discussion has been closed.