How to use datetime picker in Editor when "name" is actually a Integer (long)

How to use datetime picker in Editor when "name" is actually a Integer (long)

mhwhetmoremhwhetmore Posts: 3Questions: 1Answers: 0
edited September 2014 in Free community support
$(document).ready(function() {
    var editor = new $.fn.dataTable.Editor( {
        "ajax": "php/table.Log_Rec.php",
        "table": "#Log_Rec",
        "fields": [
            {
                "label": "Date",
                "name": "LogDate",  // epoch datetime (milliseconds since Jan 1, 1970)
                "type": "date"   
// what goes here?
// I need to set the date and the time
            },
            {
                "label": "Driver ID",
                "name": "LogDriver",
                "type": "text"
            },

The following "render" code works well in dataTable using moment(Number(data)).format('lll')...
Took much experimenting to figure this out...

    $('#Log_Rec').dataTable( {
        "dom": "Tfrtip",
        "ajax": "php/table.Log_Rec.php",
        "columns": [
            {
                "data": "LogDate",
        "render": function(data) 
        { return moment(Number(data)).format('lll'); }
            },
            {
                "data": "LogDriver"
            },

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    Ideally you would feed the date plug-in that you are using a format that it understands. Is that possible? It looks like you are using the Editor PHP libraries so you could use the formatters to convert the date into a useable format on the client-side.

    Alternatively, you could use fields.data as a function much in the same way as your have used columns.render as a function - but it has more complexity in that you need to handle the setting of data as well!

    Allan

  • mhwhetmoremhwhetmore Posts: 3Questions: 1Answers: 0

    These forms and dataTables are created using the useful Generator.
    This makes it easy to layout the foundation, however I am lost when it comes to more complex issues without wasting HUGE amounts of time trying to research and figure it out. I have just a background knowledge of PHP, JS, very little CSS or web design in general.

    What I really need is to contract someone with a good working knowledge using this product and extending the grids and forms I create. Several forms and grids will require a join to other MySQL tables to populate fields correctly. I have already mocked this behavior using KoolPHP but prefer this product's look, response and modern code base.

    Do you have a "Help Wanted" section or how do you suggest I proceed attracting the right person?

    Thanks

    Mike

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    Hi Mike,

    There isn't a Help Wanted section for this site at the moment. Normally I would be happy to take a look at it myself, but I'm fully committed already for the next north or so. You could try posting on ODesk or similar.

    Alternatively perhaps I can show how to get one setup and you can then use that as a basis for doing the others?

    Allan

  • mhwhetmoremhwhetmore Posts: 3Questions: 1Answers: 0

    I would be very grateful if you could help me out when you can.
    Do you have an email where I can send you the particulars, codes and other infos?
    I could certainly learn from actual examples based in my projects. There aren't that many really...
    I have already learned how to make the checkbox function properly, getting and setting the value from the DB. This was huge!

    Thanks

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Sure - allan @ this-domain.net will get to me.

    Allan

This discussion has been closed.