I followed this jquery plugin to make scrollable
the selectable
element from default jQueryUI
library.
The demo presents the list as ul
html element, I would like to create a table
which uses this feature. I need declare table
width as 100%
and td
width 50%
.
my code is:
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js"></script>
<script src="http://karolyi.github.io/ui-selectableScroll/javascripts/selectableScroll.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="jquery-ui-ext.css">
<style type="text/css">
<style>
.fixed_header{
width: 100%;
border-collapse: collapse;
}
.fixed_header tr{
width: 100%;
}
.fixed_header td{
width: 50%;
}
.fixed_header tbody{
display:block;
width: 100%;
overflow: auto;
height: 100px;
}
td.ui-selecting {
border: 1px dotted red;
}
td.ui-selected {
background: red;
}
</style>
<script>
$(document).ready(function () {
$('.fixed_header').selectableScroll({
filter: 'td'
});
});
</script>
</head>
<body>
<div style="width:100%;height:300px;background:black"></div>
<table class="fixed_header">
<tbody>
<tr><td>row 1-0</td><td>row 1-1</td></tr>
<tr><td>row 2-0</td><td>row 2-1</td></tr>
<tr><td>row 3-0</td><td>row 3-1</td></tr>
<tr><td>row 4-0</td><td>row 4-1</td></tr>
<tr><td>row 5-0</td><td>row 5-1</td></tr>
<tr><td>row 6-0</td><td>row 6-1</td></tr>
<tr><td>row 7-0</td><td>row 7-1</td></tr>
</tbody>
</table>
</body>
</html>
and there are a few problems. The most important is because the scrollable
function does not work as expected (as demo example) - the body
of table
should be scrollable when user uses the selectable
(currently is not). The second problem is about the witdh
of my elements, it does not fill the 100% od window.
How is it possible to create the selectable and scrollable in table?