抱歉我的英文。
我正在使用tablesorter 2.0和scroller。
我在我的页面上打电话。当我推动表格时,它按键滚动。但是我想在没有按下桌子的情况下。实际上加载页面。
设置$("#tableStockSLI").focus()
不起作用。
我怎么能这样做?
<script type="text/javascript" src="/public/javascripts/jquery-1.11.1.js"></script>
<script type="text/javascript" src="/public/javascripts/jquery-ui-1.11.1/jquery-ui.js"></script>
<script type="text/javascript" src="/public/javascripts/jquery.tablesorter.js"></script>
<script type="text/javascript" src="/public/javascripts/jquery.tablesorter.widgets-filter-formatter.js"></script>
<script type="text/javascript" src="/public/javascripts/jquery.tablesorter.widgets.js"></script>
<script type="text/javascript" src="/public/javascripts/widget-scroller.js"></script>
&#13;
$("#tableStockSLI").tablesorter({
theme: 'blue',
widthFixed : true,
showProcessing: true,
widgets: [ "zebra","filter", "scroller"],
widgetOptions : {
scroller_height : 300,
scroller_upAfterSort: false,
scroller_jumpToHeader: false
},
sortList: [[1,0],[2,0]]
});
&#13;
答案 0 :(得分:0)
要提供滚动div焦点,您只需要将滚动容器(tablesorter-scroller-table
)设为tabindex
。试试这段代码(demo):
$(function () {
$('table').tablesorter({
theme: 'blue',
widthFixed: true,
showProcessing: true,
widgets: ["zebra", "filter", "scroller"],
widgetOptions: {
scroller_height: 200,
scroller_upAfterSort: false,
scroller_jumpToHeader: false
},
sortList: [[1, 0],[2, 0]],
initialized: function(){
// give scroller a tabindex to allow focusing
$('.tablesorter-scroller-table').attr('tabindex', 1);
}
});
$(document).on('keydown', function(){
// keyboard pageup/down now always works in scroll window
$('.tablesorter-scroller-table').focus();
});
});