bootstrap-table-defer-url.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * When using server-side processing, the default mode of operation for
  3. * bootstrap-table is to simply throw away any data that currently exists in the
  4. * table and make a request to the server to get the first page of data to
  5. * display. This is fine for an empty table, but if you already have the first
  6. * page of data displayed in the plain HTML, it is a waste of resources. As
  7. * such, you can use data-defer-url instead of data-url to allow you to instruct
  8. * bootstrap-table to not make that initial request, rather it will use the data
  9. * already on the page.
  10. *
  11. * @author: Ruben Suarez
  12. * @webSite: http://rubensa.eu.org
  13. * @version: v1.0.0
  14. */
  15. (function($) {
  16. 'use strict';
  17. $.extend($.fn.bootstrapTable.defaults, {
  18. deferUrl : undefined
  19. });
  20. var BootstrapTable = $.fn.bootstrapTable.Constructor, _init = BootstrapTable.prototype.init;
  21. BootstrapTable.prototype.init = function() {
  22. _init.apply(this, Array.prototype.slice.apply(arguments));
  23. if (this.options.deferUrl) {
  24. this.options.url = this.options.deferUrl;
  25. }
  26. }
  27. })(jQuery);