Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82273

Disabled Editor field with plugin

$
0
0

I have a DatetimePicker using a plug in:

var editor_exportsets = new $.fn.dataTable.Editor({
fields: [ {
            label: "Date/Time:",
            name: "schedule.onceDateTime",
            type: "datetime",
            labelInfo: "(YYYY-MM-DD HH:mm)",
            opts: {
                pick12HourFormat: false,
                useSeconds: false,
                format: 'YYYY-MM-DD HH:mm'
}

I want to disable it when the form is busy. I tried this but it didn't work:

editor_exportsets.disable(['schedule.onceDateTime' ]);

The datepicker has its own disabled function but I'm not sure how to deploy it.
$('#datetimepicker3').data("DateTimePicker").disable();

Do i add a "disable" and "enable" function in the plug-in editor.datetimepicker.js?

$.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" />'+
                '<SPAN class="input-group-addon"><SPAN class="glyphicon"></SPAN>'+
                '</SPAN>'+
            '</DIV>'
        )
        .datetimepicker( $.extend( {}, conf.opts ) );

    return conf._input[0];
},

"get": function ( conf ) {
return conf._input.find('input').val();
},

 "set": function ( conf, val ) {
conf._input.find('input').val( 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;
}
} );

Viewing all articles
Browse latest Browse all 82273

Trending Articles