Datetime BootStrap 2

Datetime BootStrap 2

brimestonebrimestone Posts: 5Questions: 3Answers: 0
edited May 2015 in Free community support

trying to add the following options ( forceParse, clearBtn ) but cant find a way. ( seems like the only option thats working are pickDate, pickTime and format ).

{
label: "Due Date",
name: "duedate",
type: "datetime",
opts: {
forceParse: false,
clearBtn: true,
pickDate: true,
pickTime: true,
format: "MM/DD/YYYY hh:mm A",
}
}

Answers

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

    I don't see a forceParse option in the documentation for the Data picker plug-in.

    I think pickDate and pickTime might have also been removed and based on the format now. Its a fast moving library that one!

    Allan

  • brimestonebrimestone Posts: 5Questions: 3Answers: 0

    I see. I see the following options ( showClear, useStrict, keepInvalid... ) how to i set those option?

    i tried it on opts: { ..., .... } but it doesn't work.

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

    Can you show me your initialisation please? Placing them in the field's opts property should work. Worth also checking that you are using the latest version of the Date picker library.

    Allan

  • brimestonebrimestone Posts: 5Questions: 3Answers: 0
    edited May 2015

    I'm using version 4.7.14

    $.fn.dataTable.Editor.fieldTypes.datetime = $.extend( true, {}, $.fn.dataTable.Editor.models.fieldType, {
                        "create": function ( conf ) {
                            var that = this;
                     
                            conf._input = $(
                                    '<div class="input-group date" id="'+conf.id+'">'+
                                        '<input type="text" class="form-control myPicker" />'+
                                        '<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>'+
                                        '</span>'+
                                    '</div>'
                                )
                                .attr( $.extend( {}, conf.attr ) )
                                .datetimepicker( $.extend( {}, conf.opts ) );
                     
                            return conf._input[0];
                        },
                     
                        
                        "get": function ( conf ) {
                            return conf._input.children('input').val();
                        },
                     
                        "set": function ( conf, val ) {
                            if(val !== null){
                                console.log("value is not null");   
                                conf._input.data("DateTimePicker").date( val );
                            }
                        },
                     
                        // Non-standard Editor methods - custom to this plug-in. Return the jquery
                        // object for the datetimepicker instance so methods can be called directly
                        inst: function ( conf ) {
                            return conf._input.data("DateTimePicker");
                        }
                    });
    
                                    {
                                            label: "Due Date",
                                            name:  "duedate",
                                            type: "datetime",
                                            opts: {
                                                keepInvalid: true,
                                                useStrict: false,
                                                sideBySide: false,
                                                showClear: true,
                                                showTodayButton: true,
                                                format: "MM/DD/YYYY hh:mm A",
                                            },
                                            dateImage: "images/calender.png",
                                    },
    
  • allanallan Posts: 63,680Questions: 1Answers: 10,498 Site admin

    I've just tried that in my local example and it appears to work as expected (frustratingly!). Toggling the showTodayButton for example will remove the today button.

    Are you able to give me a link to your page so I can debug it please? PM me by clicking my name above and then "Send Message" if you don't want to make it public.

    Allan

This discussion has been closed.