Plugin being displayed as expected

Plugin being displayed as expected

klermannklermann Posts: 277Questions: 67Answers: 1

Hello Allan, I need to know if I am correctly configuring the plugin, because it is not being displayed as expected, do you have any tips?

The format expected:

The plugin it is:
https://github.com/amazingSurge/jquery-asSpinner
`(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables', 'datatables-editor'], factory );
}
else if ( typeof exports === 'object' ) {
// Node / CommonJS
module.exports = function ($, dt) {
if ( ! $ ) { $ = require('jquery'); }
factory( $, dt || $.fn.dataTable || require('datatables') );
};
}
else if ( jQuery ) {
// Browser standard
factory( jQuery, jQuery.fn.dataTable );
}
}(function( $, DataTable ) {
'use strict';

if ( ! DataTable.ext.editorFields ) {
    DataTable.ext.editorFields = {};
}
var _fieldTypes = DataTable.Editor ?
    DataTable.Editor.fieldTypes :
    DataTable.ext.editorFields;

_fieldTypes.spinner = {
    create: function ( conf ) {
        var that = this;

        conf._input = $(
                '<div class="input-group" id="'+conf.id+'">'+
                    '<input id="receitaCor" type="text" class="form-control" value="0" />'+
                '</div>'
            )
            .attr( $.extend( {}, conf.attr ) );

        $('#receitaCor', conf._input).asSpinner().attr( $.extend( {
            id: DataTable.Editor.safeId( conf.id ),         
            type: 'text',
            'data-plugin': "asSpinner"

        }, conf.attr || {} ) );

        return conf._input[0];
    },

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

    set: function ( conf, val ) {
    },

    disable: function ( conf ) {
        conf._input.data("asSpinner").disable();
    },
    enable: function ( conf ) {
        conf._input.data("asSpinner").enable();
    },
    inst: function ( conf ) {
        return conf._input.data("asSpinner");
    }
};
}));`

Answers

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

    Personally I would loose the id since it would mean that you can only use it once on a page.

    But beyond that, I'd need a link to a test case showing the issue.

    Allan

  • klermannklermann Posts: 277Questions: 67Answers: 1

    You resend an application to Amazon EC2 and send you to enjoy

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

    I'm afraid I don't quite understand what you mean. If you have a link to a test case showing the issue, that would be great.

    Thanks,
    Allan

This discussion has been closed.