jQuery Bootgrid 的分页不起作用?
jQuery Bootgrid's pagination is not working?
我从这个 fiddle 中获取了代码:
var public_spreadsheet_url = "https://docs.google.com/spreadsheets/d/10v53Z7jR6qCaPnAHdPk8qLktHYzQtvhvVhQpxqgbJO8/pubhtml";
function init() {
Tabletop.init( { key: public_spreadsheet_url,
callback: showInfo,
simpleSheet: true } );
}
function showInfo(data, tabletop) {
data = tabletop.sheets("Devices").all();
for (var key in data[1]) {
var type = (key === 'rowNumber') ? ' data-type="numeric"' : '';
$("#main-table thead tr").append('<th data-column-id="' + key + '"' + type + '>' + key + '</th>');
}
$("#main-table").bootgrid().bootgrid("append", data);
}
init();
并在我的 page 上实现了它。
但是分页不起作用,但它在上面的 jsFiddle 示例中工作正常?
您熟悉浏览器中的调试工具吗?我检查了你的网站,你在那里登录了几个错误...
Uncaught TypeError: Cannot read property 'substr' of undefined
http://www.google.com/ads/user-lists/1006861511/?fmt=1&num=1&cv=7&frm=0&url…tions/27783726/jquery-bootgrids-pagination-is-not-working&random=609575088
Failed to load resource: net::ERR_CACHE_MISS
使用 Google Chrome,右键单击页面并 select 检查元素,然后 select 控制台查看错误。
似乎与某些 CMS 和 jQuery Bootgrid 不兼容。 Bootgrid 源代码中的以下行,以及涉及查找锚点 href 的类似行,必须进行修改:
var command = $this.attr("href").substr(1);
类似于:
var href = $this.attr("href");
var command = (href ? href : $this.find('a').attr('href')).substr(1);
否则将在 undefined
元素的 undefined
href 属性上调用 substr
。
我从这个 fiddle 中获取了代码:
var public_spreadsheet_url = "https://docs.google.com/spreadsheets/d/10v53Z7jR6qCaPnAHdPk8qLktHYzQtvhvVhQpxqgbJO8/pubhtml";
function init() {
Tabletop.init( { key: public_spreadsheet_url,
callback: showInfo,
simpleSheet: true } );
}
function showInfo(data, tabletop) {
data = tabletop.sheets("Devices").all();
for (var key in data[1]) {
var type = (key === 'rowNumber') ? ' data-type="numeric"' : '';
$("#main-table thead tr").append('<th data-column-id="' + key + '"' + type + '>' + key + '</th>');
}
$("#main-table").bootgrid().bootgrid("append", data);
}
init();
并在我的 page 上实现了它。
但是分页不起作用,但它在上面的 jsFiddle 示例中工作正常?
您熟悉浏览器中的调试工具吗?我检查了你的网站,你在那里登录了几个错误...
Uncaught TypeError: Cannot read property 'substr' of undefined http://www.google.com/ads/user-lists/1006861511/?fmt=1&num=1&cv=7&frm=0&url…tions/27783726/jquery-bootgrids-pagination-is-not-working&random=609575088 Failed to load resource: net::ERR_CACHE_MISS
使用 Google Chrome,右键单击页面并 select 检查元素,然后 select 控制台查看错误。
似乎与某些 CMS 和 jQuery Bootgrid 不兼容。 Bootgrid 源代码中的以下行,以及涉及查找锚点 href 的类似行,必须进行修改:
var command = $this.attr("href").substr(1);
类似于:
var href = $this.attr("href");
var command = (href ? href : $this.find('a').attr('href')).substr(1);
否则将在 undefined
元素的 undefined
href 属性上调用 substr
。