Datatables

by Maycon Brito

HTML

<link rel="stylesheet" href="http://cdn.datatables.net/plug-ins/3cfcc339e89/integration/jqueryui/dataTables.jqueryui.css">
<script src="http://cdn.datatables.net/plug-ins/3cfcc339e89/integration/jqueryui/dataTables.jqueryui.js"></script>
<script src="http://cdn.datatables.net/1.10.4/js/jquery.dataTables.js"></script>
<link rel="stylesheet" href="http://site1.portalsibe.com.br/fwsibe/sistema/libraries/interface/javascript/lib/jquery/jquery-ui/jquery-ui.custom.min.css">
<link rel="stylesheet" href="http://192.168.101.2/fwsibe/assets/css/styles.css">

JavaScript

/**
 * Script de funções do componente <table>
 * 
 * @author Maycon Brito
 * @since 26/09/2013
 */
var Table = function(opcoes, classes){
    console.log('carregando');
    var seletor = $('#tabelainfo');
    this.init = function () {


        if (opcoes === undefined || opcoes === null) {
            opcoes = [];
        }

        //Define o array com as opções padrões para o plugin datatables
        opcoes['language'] = {
            "sEmptyTable": "Nenhum registro encontrado",
            "sInfo": "Mostrando de _START_ até _END_ de _TOTAL_ registros",
            "sInfoEmpty": "Mostrando 0 até 0 de 0 registros",
            "sInfoFiltered": "(Filtrados de _MAX_ registros)",
            "sInfoPostFix": "",
            "sInfoThousands": ".",
            "sLengthMenu": "_MENU_ resultados por página",
            "sLoadingRecords": "Carregando...",
            "sProcessing": "Processando...",
            "sZeroRecords": "Nenhum registro encontrado",
            "sSearch": "Pesquisar",
            "oPaginate": {
                "sNext": "Próximo",
                "sPrevious": "Anterior",
                "sFirst": "Primeiro",
                "sLast": "Último"
            },
            "oAria": {
                "sSortAscending": ": Ordenar colunas de forma ascendente",
                "sSortDescending": ": Ordenar colunas de forma descendente"
            }
        };
        opcoes['bJQueryUI'] = true;
        //opcoes["scrollX"] = true;

        //Adiciona novas classes à tabela do datatable
        seletor.addClass(classes);

        //Executa o datatable com as opções especificadas acima
        seletor.dataTable(opcoes);
    };
    
    //Executa o método de inicialização do objeto
    this.init();

};