Sorry for my English.
I am using tablesorter 2.0 and scroller.
I call on my page. When I push the table then it works scroll by keys. But I want to without pressing on the table. Practically by load the page.
set $("#tableStockSLI").focus()
does not work.
How can I do this?
<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>
$("#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]]
});
To give the scroller div focus, you just need to give the scroller container (tablesorter-scroller-table
) a tabindex
. Try this code (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();
});
});