/*! * Bootstrap Data Table Plugin v1.5.5 * * Author: Jeff Dupont * ========================================================== * Copyright 2012 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ (function($) { /* DATATABLE CLASS DEFINITION * ========================== */ var DataTable = function(element, options) { this.$element = $(element); this.options = options; this.pendingRequest = null; this.enabled = true; this.columns = []; this.rows = []; this.buttons = []; // this needs to be handled better this.localStorageId = "datatable_" + (options.id || options.url.replace(/\W/gi, "_")); // set the defaults for the column options array for (var column in this.options.columns) { // check sortable if (typeof this.options.columns[column].sortable === undefined) this.options.columns[column].sortable = true; } this.$default = this.$element.children().length ? this.$element.children() : $("
") .addClass("alert alert-danger") .html(i18n.no_results_found); this.$element.addClass("clearfix"); // clear out the localStorage for this entry if (localStorage) { localStorage[this.localStorageId] = "false"; } if ( this.options.tablePreRender && typeof this.options.tablePreRender === "function" ) this.options.tablePreRender.call(this); // initialize the toolbar _initToolbar.call(this); if (this.options.autoLoad === true) this.render(); }; DataTable.prototype = { constructor: DataTable, render: function() { var o = this.options, $e = this.$element; // show loading this.loading(true); // reset the columns and rows this.columns = []; this.rows = []; this.buttons = []; this.$wrapper = undefined; this.$table = undefined; this.$header = undefined; this.$body = undefined; this.$footer = undefined; this.$pagination = undefined; if (this.$toolbar) this.$toolbar.remove(); // add summary on top this.$summary_table = $("' + i18n.showing_x_to_y_rows.sformat(start, end, o.totalRows) + "