forked from shuxuecode/bootstrap-table
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request wenzhixin#2738 from rubensa/develop
Bootstrap Table Defer URL Extension
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Table Defer URL | ||
|
||
Use Plugin: [bootstrap-table-defer-url](https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/defer-url) | ||
|
||
## Usage | ||
|
||
```html | ||
<script src="extensions/defer-url/bootstrap-table-defer-url.js"></script> | ||
``` | ||
|
||
## Options | ||
|
||
### deferUrl | ||
|
||
* type: String | ||
* description: When using server-side processing, the default mode of operation for bootstrap-table is to simply throw away any data that currently exists in the table and make a request to the server to get the first page of data to display. This is fine for an empty table, but if you already have the first page of data displayed in the plain HTML, it is a waste of resources. As such, you can use data-defer-url instead of data-url to allow you to instruct bootstrap-table to not make that initial request, rather it will use the data already on the page. | ||
* default: `null` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* When using server-side processing, the default mode of operation for | ||
* bootstrap-table is to simply throw away any data that currently exists in the | ||
* table and make a request to the server to get the first page of data to | ||
* display. This is fine for an empty table, but if you already have the first | ||
* page of data displayed in the plain HTML, it is a waste of resources. As | ||
* such, you can use data-defer-url instead of data-url to allow you to instruct | ||
* bootstrap-table to not make that initial request, rather it will use the data | ||
* already on the page. | ||
* | ||
* @author: Ruben Suarez | ||
* @webSite: http://rubensa.eu.org | ||
* @version: v1.0.0 | ||
*/ | ||
|
||
(function($) { | ||
'use strict'; | ||
|
||
$.extend($.fn.bootstrapTable.defaults, { | ||
deferUrl : undefined | ||
}); | ||
|
||
var BootstrapTable = $.fn.bootstrapTable.Constructor, _init = BootstrapTable.prototype.init; | ||
|
||
BootstrapTable.prototype.init = function() { | ||
_init.apply(this, Array.prototype.slice.apply(arguments)); | ||
|
||
if (this.options.deferUrl) { | ||
this.options.url = this.options.deferUrl; | ||
} | ||
} | ||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "DeferURL", | ||
"version": "1.0.0", | ||
"description": "Plugin to defer server side processing.", | ||
"url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/defer-url", | ||
"example": "http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/defer-url.html", | ||
|
||
"plugins": [{ | ||
"name": "bootstrap-table-defer-url", | ||
"url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/defer-url" | ||
}], | ||
|
||
"author": { | ||
"name": "rubensa", | ||
"image": "https://avatars1.githubusercontent.com/u/1469340" | ||
} | ||
} |