UNPKG

1.61 kBJavaScriptView Raw
1(function (global, factory) {
2 if (typeof define === "function" && define.amd) {
3 define([], factory);
4 } else if (typeof exports !== "undefined") {
5 factory();
6 } else {
7 var mod = {
8 exports: {}
9 };
10 factory();
11 global.bootstrapTableDeferUrl = mod.exports;
12 }
13})(this, function () {
14 'use strict';
15
16 /**
17 * When using server-side processing, the default mode of operation for
18 * bootstrap-table is to simply throw away any data that currently exists in the
19 * table and make a request to the server to get the first page of data to
20 * display. This is fine for an empty table, but if you already have the first
21 * page of data displayed in the plain HTML, it is a waste of resources. As
22 * such, you can use data-defer-url instead of data-url to allow you to instruct
23 * bootstrap-table to not make that initial request, rather it will use the data
24 * already on the page.
25 *
26 * @author: Ruben Suarez
27 * @webSite: http://rubensa.eu.org
28 * @version: v1.0.0
29 */
30
31 (function ($) {
32 'use strict';
33
34 $.extend($.fn.bootstrapTable.defaults, {
35 deferUrl: undefined
36 });
37
38 var BootstrapTable = $.fn.bootstrapTable.Constructor,
39 _init = BootstrapTable.prototype.init;
40
41 BootstrapTable.prototype.init = function () {
42 _init.apply(this, Array.prototype.slice.apply(arguments));
43
44 if (this.options.deferUrl) {
45 this.options.url = this.options.deferUrl;
46 }
47 };
48 })(jQuery);
49});
\No newline at end of file