resize columns in a table | Newbie | | Join Date: Jan 2007
Posts: 5
| | |
I have a problem kaking the columns of a table resizeable by the user on the browser.can some1 help me out with this.
Is it a property in the css that i need to add?
regards and thanks in advance
|  | Expert | | Join Date: Dec 2006 Location: Pittsburgh
Posts: 171
| | | re: resize columns in a table Quote:
Originally Posted by srinivd1 Hi,
I have a problem kaking the columns of a table resizeable by the user on the browser.can some1 help me out with this.
Is it a property in the css that i need to add?
regards and thanks in advance HTML tables aren't resizable the way you see tables in microsoft apps. There's isn't a single property you can change to do it. You're going to have to write a bunch of DHTML/JS in order to do that.
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,750
| | | re: resize columns in a table
Yes, you will need DHTML to obtain this functionality.
Check this link for a cross-browser table as opposed to one limited to IE only. It offers amongst other things resizing.
See how you get along with that.
| | Newbie | | Join Date: Jan 2007
Posts: 5
| | | re: resize columns in a table Quote:
Originally Posted by acoder Yes, you will need DHTML to obtain this functionality.
Check this link for a cross-browser table as opposed to one limited to IE only. It offers amongst other things resizing.
See how you get along with that. thanks for the link, have tried that one doesnt seeme xactly like excel resize but should do good.Thanks :)
| | Newbie | | Join Date: Feb 2007
Posts: 2
| | | re: resize columns in a table |  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,750
| | | re: resize columns in a table
Welcome to TheScripts.
Thanks for sharing your code.
Just one or two things I'd like to point out. Never display your email, it will get spammed, so I've removed it from your post. Secondly, post code using code tags.
I haven't tested your code, but it seems like old code if it's using document.all. All browsers after 1998 use the standard document.getElementById.
| | Newbie | | Join Date: Mar 2007
Posts: 2
| | | re: resize columns in a table
Based in the past one but works in mozilla and less code: -
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-
"http://www.w3.org/TR/html4/loose.dtd">
-
<html>
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-
<title>Untitled Document</title>
-
<script language="javascript">
-
var firefox = document.getElementById&&!document.all;
-
var isdrag = false;
-
var x0 = 0,y0=0,tx=0,ty=0;
-
var anchoc=0;anchot=0;
-
var objon = null;tabla = null;
-
getTopPos = function(inputObj)
-
{
-
var returnValue = inputObj.offsetTop;
-
while((inputObj = inputObj.offsetParent) != null){
-
if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
-
}
-
return returnValue;
-
}
-
getLeftPos = function(inputObj)
-
{
-
var returnValue = inputObj.offsetLeft;
-
while((inputObj = inputObj.offsetParent) != null){
-
if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
-
}
-
return returnValue;
-
}
-
function comienza(e){
-
if(!firefox)e = event;
-
objon = (!firefox)?e.srcElement:e.target;
-
if(objon.className == "arrastrable"){
-
isdrag = true;
-
tabla = document.getElementById("arrastrablet");
-
x0 = e.clientX; y0 = e.clientY;
-
tx = getLeftPos(objon); ty = getTopPos(objon);
-
anchoc = objon.offsetWidth;
-
anchot = tabla.offsetWidth;
-
}
-
}
-
function moviendo(e){
-
if(!firefox)e = event;
-
if(isdrag){
-
ic=e.clientX-x0+anchoc;
-
it=e.clientX-x0+anchot;
-
objon.style.width = ic + "px";
-
tabla.style.width = it + "px";
-
window.status = ic + "-" + it;
-
}
-
}
-
function termina(e){
-
isdrag = false;
-
}
-
document.onmouseup = termina;
-
document.onmousemove = moviendo;
-
document.onmousedown=comienza;
-
</script>
-
<style type="text/css">
-
<!--
-
.style1 {color: #FFFFFF}
-
-->
-
</style>
-
</head>
-
-
<body>
-
<table width="100%" border="1" cellspacing="1" cellpadding="1" id="arrastrablet">
-
<tr bgcolor="#0000FF">
-
<td class="arrastrable"><span class="style1">Arrastra 1</span></td>
-
<td class="arrastrable"><span class="style1">Arrastra 2</span></td>
-
<td class="arrastrable"><span class="style1">Arrastra 3</span></td>
-
<td class="arrastrable"><span class="style1">Arrastra 4</span></td>
-
</tr>
-
<tr>
-
<td>coor (0,0)</td>
-
<td>coor (1,0)</td>
-
<td>coor (2,0)</td>
-
<td>coor (3,0)</td>
-
</tr>
-
<tr>
-
<td>coor (0,1)</td>
-
<td>coor (1,1)</td>
-
<td>coor (2,1)</td>
-
<td>coor (3,1)</td>
-
</tr>
-
</table>
-
</body>
-
</html>
-
| | Newbie | | Join Date: Mar 2007
Posts: 2
| | | re: resize columns in a table
Small correction
Based in the past one but works in mozilla and less code: -
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-
"http://www.w3.org/TR/html4/loose.dtd">
-
<html>
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-
<title>Untitled Document</title>
-
<script language="javascript">
-
var firefox = document.getElementById&&!document.all;
-
var isdrag = false;
-
var x0 = 0,y0=0,tx=0,ty=0;
-
var anchoc=0;anchot=0;
-
var objon = null;tabla = null;
-
getTopPos = function(inputObj)
-
{
-
var returnValue = inputObj.offsetTop;
-
while((inputObj = inputObj.offsetParent) != null){
-
if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
-
}
-
return returnValue;
-
}
-
getLeftPos = function(inputObj)
-
{
-
var returnValue = inputObj.offsetLeft;
-
while((inputObj = inputObj.offsetParent) != null){
-
if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
-
}
-
return returnValue;
-
}
-
function comienza(e){
-
if(!firefox)e = event;
-
objon = (!firefox)?e.srcElement:e.target;
-
if(objon.className == "arrastrable"){
-
isdrag = true;
-
tabla = document.getElementById("arrastrablet");
-
x0 = e.clientX; y0 = e.clientY;
-
tx = getLeftPos(objon); ty = getTopPos(objon);
-
anchoc = objon.offsetWidth;
-
anchot = tabla.offsetWidth;
-
}
-
}
-
function moviendo(e){
-
if(!firefox)e = event;
-
if(isdrag){
-
ic=e.clientX-x0+anchoc;
-
it=e.clientX-x0+anchot;
-
if(ic >= 5){
-
objon.style.width = ic + "px";
-
window.status = ic + "-" + it;
-
tabla.style.width = it + "px";
-
}else{
-
-
}
-
}
-
}
-
function termina(e){
-
isdrag = false;
-
}
-
document.onmouseup = termina;
-
document.onmousemove = moviendo;
-
document.onmousedown=comienza;
-
</script>
-
<style type="text/css">
-
<!--
-
.style1 {color: #FFFFFF}
-
.arrastrable{
-
width:100px;
-
overflow:hidden;
-
}
-
-->
-
</style>
-
</head>
-
-
<body>
-
<table border="1" cellspacing="1" cellpadding="1" id="arrastrablet">
-
<tr bgcolor="#0000FF">
-
<td class="arrastrable"><span class="style1">Arrastra 1</span></td>
-
<td class="arrastrable"><span class="style1">Arrastra 2</span></td>
-
<td class="arrastrable"><span class="style1">Arrastra 3</span></td>
-
<td class="arrastrable"><span class="style1">Arrastra 4</span></td>
-
</tr>
-
<tr>
-
<td>coor (0,0)</td>
-
<td>coor (1,0)</td>
-
<td>coor (2,0)</td>
-
<td>coor (3,0)</td>
-
</tr>
-
<tr>
-
<td>coor (0,1)</td>
-
<td>coor (1,1)</td>
-
<td>coor (2,1)</td>
-
<td>coor (3,1)</td>
-
</tr>
-
</table>
-
</body>
-
</html>
-
-
| | Newbie | | Join Date: May 2007
Posts: 14
| | | re: resize columns in a table
I have modified the original script to be a little bit more user-friendly. The "move" cursor is now only displayed on the edge of the colums. I have also made the demo table scrollable and sortable.
My question is ..
How do I in IE prevent the onclick action from being fired when I am done dragging?
have tried "window.event.cancelBubble = true", for onmouseup , onmousedown, and onmousemove handlers. The onclick sort action always seems to get fired. Any help would be greatly appeciated.
Steve
sort code. http://www.kryogenix.org/code/browse...e/sorttable.js.
Here is the modified code.
[HTML]<HTML>
<HEAD>
<style>
[/HTML] - h1, h2{
-
font-family:Verdana, Arial, Helvetica, sans-serif;
-
font-size:13px;
-
-
}
-
.move
-
{
-
width:100%;
-
background-color:#99CCFF;
-
border-bottom:1px solid blue;
-
font-size:14px;
-
font-family:vardana;
-
font-color:"#33CCAA";
-
text-align:center;
-
}
-
-
.info
-
{
-
width:100%;
-
background-color:#99CCFF;
-
border-top:1px solid blue;
-
font-size:13px;
-
font-family:vardana;
-
font-color:"#33CCAA";
-
}
-
-
.panel2{
-
width:150; position:absolute; border:1px solid blue; left:500; top:200; font-size:13px; font-family:vardana;}
-
-
.panel{
-
width:150; position:absolute; border:1px solid blue; left:350; top:200; font-size:13px; font-family:vardana;}
-
.panel a:visited{color:blue;}
-
-
.panel a{text-decoration:none;color:blue}
-
-
.panel a:hover{text-decoration:none;}
-
-
-
-
#panel a.visited{
-
-
text-decoration:none;
-
-
}
-
-
.menu
-
-
{
-
-
width:100%;
-
-
background-color:lightyellow;
-
-
font-size:13px;
-
-
font-family:vardana;
-
-
}
- </style>
-
-
<!--[if IE]>
-
<style type="text/css">
- div.scrollable {
-
/* shrink the window, adjust for the 2 border pixels */
-
height:expression( this.getElementsByTagName('TABLE')[0].clientHeight >= 80 ? "80px": "auto" );
-
overflow-x: visible;
-
overflow-y: auto;
-
}
-
-
div.scrollable table {
-
/* adjust for the 17 pixels for the scrollbar */
-
width: expression(this.parentNode.offsetWidth-17);
-
}
-
-
/* set the table row */
-
div.scrollable table thead tr {
-
position: relative;
-
/* this fixes IE header jumping bug */
-
top: expression( this.parentNode.parentNode.parentNode.scrollTop + 'px' );
-
}
-
</style>
-
<![endif]-->
-
-
<!-- if mozilla -->
-
<style type="text/css">
-
html>body div.TableContainer table tbody {
-
height: 20px;
-
overflow: auto;
-
}
-
-
/* add 17 for the scrollbar */
-
html>body div.TableContainer div.scrollbarCol {
-
width:17px;
-
}
-
</style>
-
-
<script type="text/javascript" src="http://www.kryogenix.org/code/browser/sorttable/sorttable.js" >
-
</script>
-
-
<SCRIPT LANGUAGE="JavaScript">
-
/// DEVELPED BY SYED NAVED ULLAH SHAH
-
// /********
-
/// CATALYST IT SOLUTIONS(PVT) LTD
-
///CATALYST.PK
-
//
-
-
N = (document.all) ? 0 : 1;
-
var ob;
-
var over = false;
-
var over_id ="";
-
var iEdgeThreshold = 10;
-
-
function TableResize_findPos(obj) {
-
var curleft = curtop = 0;
-
if (obj.offsetParent) {
-
curleft = obj.offsetLeft;
-
curtop = obj.offsetTop;
-
while (obj = obj.offsetParent) {
-
curleft += obj.offsetLeft;
-
curtop += obj.offsetTop;
-
}
-
}
-
return [curleft,curtop];
-
}
-
-
/* Function that tells me if on the border or not */
-
function TableResize_isOnBorderLeft( objTable, objTh,event){
-
var left = objTh.offsetLeft;
-
var pos = TableResize_findPos(objTable);
-
var absLeft = pos[0] + left;
-
-
if( event.clientX < (absLeft + iEdgeThreshold) ){
-
return 1;
-
}
-
return 0;
-
}
-
-
function TableResize_isOnBorderRight( objTable, objTh,event){
-
var width = objTh.offsetWidth;
-
var left = objTh.offsetLeft;
-
var pos = TableResize_findPos(objTable);
-
var absRight = pos[0] + left + width;
-
-
if( event.clientX > (absRight - iEdgeThreshold) ){
-
return 1;
-
}
-
return 0;
-
}
-
-
function TableResize_getNodeName(objReference,nodeName)
-
{
-
var oElement = objReference;
-
while (oElement != null && oElement.tagName != null && oElement.tagName != "BODY") {
-
if (oElement.tagName.toUpperCase() == nodeName) {
-
return oElement;
-
}
-
oElement = oElement.parentNode;
-
}
-
return null;
-
}
-
-
-
function do_resize(objTh,event){
-
if(event == null){
-
event = window.event;
-
}
-
var objTable = TableResize_getNodeName(objTh, "TABLE");
-
if( TableResize_isOnBorderLeft( objTable, objTh,event) ){
-
objTh.style.cursor="e-resize";
-
return true;
-
}
-
else if( TableResize_isOnBorderRight( objTable, objTh,event) ){
-
objTh.style.cursor="e-resize";
-
return true;
-
}
-
-
objTh.style.cursor="";
-
return false;
-
}
-
-
function MD(e) {
-
MOUSTSTART_X=event.clientX;
-
MOUSTSTART_Y=event.clientY;
-
if (over){
-
if (N) {
-
ob = document.getElementById(over_id);
-
X=e.layerX;
-
Y=e.layerY;
-
return false;
-
}
-
-
else{
-
-
ob = document.getElementById(over_id);
-
ob2 = document.getElementById("MAINTABLE");
-
obwidth=parseInt(ob.style.width);
-
obwidth2=parseInt(ob2.style.width);
-
X=event.offsetX;
-
Y=event.offsetY;
-
-
}
-
-
}
-
}
-
-
-
function MM(e) {
-
-
if (ob) {
-
if (N) {
-
ob.style.top = e.pageY-Y;
-
ob.style.left = e.pageX-X;
-
}
-
else{
-
st=event.clientX-MOUSTSTART_X+obwidth;
-
st2=event.clientX-MOUSTSTART_X+obwidth2;
-
-
if(st>=30){
-
ob.style.width=st;
-
ob2.style.width=st2;
-
document.getElementById("status").innerHTML=st;
-
}
-
document.selection.empty();
-
}
-
}
-
}
-
-
function MU(e) {
-
-
if(ob != null){
-
document.selection.empty();
-
ob = null;
-
}
-
}
-
-
if (N) {
-
document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
-
}
-
-
document.onmousedown = MD;
-
document.onmousemove = MM;
-
document.onmouseup = MU;
|  | Expert | | Join Date: Sep 2006
Posts: 5,829
| | | re: resize columns in a table
Am I missing something? Above it was said html tables are not resizable. Why can't the 'height' and 'width' CSS be used?
| | Newbie | | Join Date: May 2007
Posts: 14
| | | re: resize columns in a table
Here are my final mods. It is based on
SYED NAVED ULLAH SHAH and http://www.kryogenix.org/code/browse...e/sorttable.js solutions.
The table columns are resizable, table is sortable and scrollable and works in both IE and Mozilla.
I was told that you can not prevent an onclick event from being fired. If you don't want the column sorted when you resize then release the mouse outside the column. - <HTML>
-
<HEAD>
-
<style>
-
h1, h2{
-
font-family:Verdana, Arial, Helvetica, sans-serif;
-
font-size:13px;
-
-
}
-
.move
-
{
-
width:100%;
-
background-color:#99CCFF;
-
border-bottom:1px solid blue;
-
font-size:14px;
-
font-family:vardana;
-
font-color:"#33CCAA";
-
text-align:center;
-
}
-
-
.info
-
{
-
width:100%;
-
background-color:#99CCFF;
-
border-top:1px solid blue;
-
font-size:13px;
-
font-family:vardana;
-
font-color:"#33CCAA";
-
}
-
-
.panel2{
-
width:150; position:absolute; border:1px solid blue; left:500; top:200; font-size:13px; font-family:vardana;}
-
-
.panel{
-
width:150; position:absolute; border:1px solid blue; left:350; top:200; font-size:13px; font-family:vardana;}
-
.panel a:visited{color:blue;}
-
-
.panel a{text-decoration:none;color:blue}
-
-
.panel a:hover{text-decoration:none;}
-
-
-
-
#panel a.visited{
-
-
text-decoration:none;
-
-
}
-
-
.menu
-
-
{
-
-
width:100%;
-
-
background-color:lightyellow;
-
-
font-size:13px;
-
-
font-family:vardana;
-
-
}
-
-
</style>
-
-
<!--[if IE]>
-
<style type="text/css">
-
div.scrollable {
-
/* shrink the window, adjust for the 2 border pixels */
-
height:expression( this.getElementsByTagName('TABLE')[0].clientHeight >= 80 ? "80px": "auto" );
-
overflow-x: visible;
-
overflow-y: auto;
-
}
-
-
div.scrollable table {
-
/* adjust for the 17 pixels for the scrollbar */
-
width: expression(this.parentNode.offsetWidth-17);
-
}
-
-
/* set the table row */
-
div.scrollable table thead tr {
-
position: relative;
-
/* this fixes IE header jumping bug */
-
top: expression( this.parentNode.parentNode.parentNode.scrollTop + 'px' );
-
}
-
</style>
-
<![endif]-->
-
-
<!-- if mozilla -->
-
<style type="text/css">
-
html>body div.scrollable tbody {
-
height: 80px;
-
overflow: auto;
-
}
-
-
/* add 17 for the scrollbar */
-
html>body th.scrollbarCol {
-
width:17px;
-
}
-
-
</style>
-
-
<script type="text/javascript" src="http://www.kryogenix.org/code/browser/sorttable/sorttable.js" >
-
</script>
-
-
<SCRIPT LANGUAGE="JavaScript">
-
var ob;
-
var over = false;
-
var over_id ="";
-
var iEdgeThreshold = 10;
-
-
function findPos(obj) {
-
var curleft = curtop = 0;
-
if (obj.offsetParent) {
-
curleft = obj.offsetLeft;
-
curtop = obj.offsetTop;
-
while (obj = obj.offsetParent) {
-
curleft += obj.offsetLeft;
-
curtop += obj.offsetTop;
-
}
-
}
-
return [curleft,curtop];
-
}
-
-
/* Function that tells me if on the border or not */
-
function isOnBorderLeft(objTable,objTh,event){
-
var left = objTh.offsetLeft;
-
var pos = findPos(objTable);
-
var absLeft = pos[0] + left;
-
-
if( event.clientX < (absLeft + iEdgeThreshold) ){
-
return 1;
-
}
-
return 0;
-
}
-
-
function isOnBorderRight(objTable,objTh,event){
-
var width = objTh.offsetWidth;
-
var left = objTh.offsetLeft;
-
var pos = findPos(objTable);
-
var absRight = pos[0] + left + width;
-
-
if( event.clientX > (absRight - iEdgeThreshold) ){
-
return 1;
-
}
-
return 0;
-
}
-
-
function getNodeName(objReference,nodeName){
-
var oElement = objReference;
-
while (oElement != null && oElement.tagName != null && oElement.tagName != "BODY") {
-
if (oElement.tagName.toUpperCase() == nodeName) {
-
return oElement;
-
}
-
oElement = oElement.parentNode;
-
}
-
return null;
-
}
-
-
-
function do_resize(objTh,event){
-
if(!event) event = window.event;
-
var objTable = getNodeName(objTh,"TABLE");
-
if( isOnBorderLeft(objTable, objTh,event) ){
-
objTh.style.cursor="e-resize";
-
return true;
-
}
-
else if( isOnBorderRight(objTable,objTh,event) ){
-
objTh.style.cursor="e-resize";
-
return true;
-
}
-
-
objTh.style.cursor="";
-
return false;
-
}
-
-
function MD(event) {
-
if(!event) event = window.event;
-
-
MOUSTSTART_X=event.clientX;
-
MOUSTSTART_Y=event.clientY;
-
-
if (over){
-
ob = document.getElementById(over_id);
-
ob2 = getNodeName(ob,"TABLE");
-
obwidth=parseInt(ob.style.width);
-
obwidth2=parseInt(ob2.style.width);
-
}
-
}
-
-
function MM(event) {
-
if(!event) event = window.event;
-
-
if (ob) {
-
st=event.clientX-MOUSTSTART_X+obwidth;
-
st2=event.clientX-MOUSTSTART_X+obwidth2;
-
-
if(st>=30){
-
ob.style.width=st;
-
ob2.style.width=st2;
-
document.getElementById("status").innerHTML=st;
-
}
-
if(event.stopPropagation)event.stopPropagation();
-
if(document.selection) document.selection.empty();
-
else if(window.getSelection)window.getSelection().removeAllRanges();
-
}
-
}
-
-
function MU(event) {
-
if(!event) event = window.event;
-
if(ob != null){
-
if(event.stopPropagation)event.stopPropagation();
-
if(document.selection) document.selection.empty();
-
else if(window.getSelection)window.getSelection().removeAllRanges();
-
ob = null;
-
}
-
}
-
-
document.onmousedown = MD;
-
document.onmousemove = MM;
-
document.onmouseup = MU;
-
</script>
-
-
-
</HEAD>
-
-
<BODY>
-
<!--
-
YOU MUST HAVE TO DEFINE WIDTH ON STYLE TAB.. if you leave NULL
-
IT RETURNS .. ERROR..
-
-->
-
<H1>RESIZABLE TABLE COLUMN</H1>
-
-
<table style="border: 1px gray solid">
-
<tr>
-
<td>
-
<div class="scrollable">
-
<TABLE border="1" STYLE="width:500px; overflow:hidden; table-layout:fixed" class="sortable">
-
-
<THEAD>
-
-
<TR>
-
-
<TH id="panel0" class='move' onmousemove="over=do_resize(this,event);over_id='panel0'" onmouseover="over=do_resize(this,event);over_id='panel0'" onmouseout='over=false;' style='width:100px; overflow:hidden'>CO0</TH>
-
-
<TH id="panel1" class='move' onmousemove="over=do_resize(this,event);over_id='panel1'" onmouseover="over=do_resize(this,event);over_id='panel1'" onmouseout='over=false;' style='width:100px; overflow:hidden'>CO1</TH>
-
-
<TH id="panel2" class='move' onmousemove="over=do_resize(this,event);over_id='panel2'" onmouseover="over=do_resize(this,event);over_id='panel2'" onmouseout='over=false;' style='width:100px; overflow:hidden'>CO2</TH>
-
-
<TH id="panel3" class='move' onmousemove="over=do_resize(this,event);over_id='panel3'" onmouseover="over=do_resize(this,event);over_id='panel3'" onmouseout='over=false;' style='width:100px; overflow:hidden'>CO3</TH>
-
-
<TH id="panel4" class='move' onmousemove="over=do_resize(this,event);over_id='panel4'" onmouseover="over=do_resize(this,event);over_id='panel4'" onmouseout='over=false;' style='width:100px; overflow:hidden'>CO4</TH>
-
-
<TH class="sorttable_nosort scrollbarCol"></TH>
-
-
</TR>
-
</THEAD>
-
<TBODY>
-
<TR>
-
-
<TD>1_0</TD>
-
-
-
<TD><input type="text" value="this is a very long text string" style="width:100%" ></TD>
-
-
-
<TD>1_2</TD>
-
-
-
<TD>1_3</TD>
-
-
-
<TD>1_4</TD>
-
-
-
</TR>
-
-
-
<TR>
-
-
<TD>2_0</TD>
-
-
-
<TD>2_1</TD>
-
-
-
<TD>2_2</TD>
-
-
-
<TD>2_3</TD>
-
-
-
<TD>2_4</TD>
-
-
-
</TR>
-
-
-
<TR>
-
-
<TD>3_0</TD>
-
-
-
<TD>3_1</TD>
-
-
-
<TD>3_2</TD>
-
-
-
<TD>3_3</TD>
-
-
-
<TD>3_4</TD>
-
-
-
</TR>
-
-
-
<TR>
-
-
<TD>4_0</TD>
-
-
-
<TD>4_1</TD>
-
-
-
<TD>4_2</TD>
-
-
<TD>4_3</TD>
-
<TD>4_4</TD>
-
-
</TR>
-
</TBODY>
-
</table>
-
</div>
-
</td>
-
</tr>
-
</table>
-
<div id="status"></div>
-
</HTML>
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,750
| | | re: resize columns in a table Quote:
Originally Posted by drhowarddrfine Am I missing something? Above it was said html tables are not resizable. Why can't the 'height' and 'width' CSS be used? Yes, they could be used, but then we'd probably need a bit of JavaScript if the user is going to resize the table columns (HTML/CSS+JavaScript = DHTML).
| | Newbie | | Join Date: May 2007
Posts: 14
| | | re: resize columns in a table Quote:
Originally Posted by acoder Yes, they could be used, but then we'd probably need a bit of JavaScript if the user is going to resize the table columns (HTML/CSS+JavaScript = DHTML). Here is my latest code for resizing html table.
The example table is table resizable, column resizable, searchable, sortable and scrollable.
Todo:
Searchable for mozilla. - <HTML>
-
<HEAD>
-
<style>
-
h1, h2{
-
font-family:Verdana, Arial, Helvetica, sans-serif;
-
font-size:13px;
-
-
}
-
-
</style>
-
-
<!--[if IE]>
-
<style type="text/css">
-
div.scrollable {
-
/* shrink the window */
-
height:expression( this.getElementsByTagName('TABLE')[0].clientHeight >= parseInt(this.getElementsByTagName('TBODY')[0].style.height) && parseInt(this.getElementsByTagName('TBODY')[0].style.height) > 0 ? this.getElementsByTagName('TBODY')[0].style.height : "auto" );
-
overflow-x: visible;
-
overflow-y: auto;
-
width: expression(this.getElementsByTagName('TABLE')[0].offsetWidth);
-
}
-
-
/* set the table row */
-
div.scrollable table thead tr {
-
position: relative;
-
/* this fixes IE header jumping bug, adjust for the table border */
-
top: expression( (this.parentNode.parentNode.parentNode.scrollTop - 2)+ 'px' );
-
}
-
-
/* needed for IE if tbody.height is set */
-
div.scrollable tr{
-
height:auto;
-
}
-
-
</style>
-
<![endif]-->
-
-
<style type="text/css">
-
/* if mozilla */
-
html>body div.scrollable tbody {
-
overflow: auto;
-
}
-
-
table.resizable th{
-
text-align:center;
-
overflow: hidden;
-
}
-
-
/* if mozilla, add 10 for the scrollbar */
-
html>body th.scrollbarCol {
-
width:10px;
-
}
-
-
table.resizable td{
-
overflow: hidden;
-
}
-
-
table.resizable{
-
table-layout:fixed;
-
}
-
-
table.resizable input{
-
width:100%;
-
}
-
-
table.resizable textarea{
-
width:100%;
-
}
-
-
.nowrap {
-
white-space:nowrap;
-
}
-
-
/* needed for IE */
-
table.tabular th.scrollbarCol {
-
background-color:transparent;
-
}
-
-
table.tabular {
-
FONT-SIZE: 13px;
-
FONT-FAMILY: 'Verdana, Arial, Helvetica, sans-serif';
-
COLOR: #336699;
-
}
-
-
table.tabular thead {
-
COLOR: #ffffff;
-
FONT-WEIGHT: bold;
-
}
-
-
table.tabular th{
-
background-color:#c0c0c0;
-
padding: 4px;
-
}
-
-
table.tabular td {
-
background-color:#EAF4F3;
-
padding: 2px;
-
}
-
</style>
-
<script type="text/javascript" src="http://www.kryogenix.org/code/browser/sorttable/sorttable.js" >
-
</script>
-
<SCRIPT type="text/javascript">
-
var objTh = null;
-
var objDiv = null;
-
var overColumn = false;
-
var overTable = false;
-
-
var iEdgeThreshold = 10;
-
-
function findPos(obj) {
-
var curleft = curtop = 0;
-
if (obj.offsetParent) {
-
curleft = obj.offsetLeft;
-
curtop = obj.offsetTop;
-
while (obj = obj.offsetParent) {
-
curleft += obj.offsetLeft;
-
curtop += obj.offsetTop;
-
}
-
}
-
return [curleft,curtop];
-
}
-
-
/* Function that tells me if on the right border or not */
-
function isOnBorderRight(elem,event){
-
var width = elem.offsetWidth;
-
var pos = findPos(elem);
-
var absRight = pos[0] + width;
-
-
if( event.clientX > (absRight - iEdgeThreshold) ){
-
return true;
-
}
-
-
return false;
-
}
-
-
/* Function that tells me if on the bottom border or not */
-
function isOnBorderBottom(elem,event){
-
var height = elem.offsetHeight;
-
-
var pos = findPos(elem);
-
var absTop = pos[1];
-
-
if( event.clientY > (absTop + elem.offsetHeight - iEdgeThreshold) ){
-
return true;
-
}
-
return false;
-
}
-
-
function getParentNode(objReference,nodeName,className){
-
var oElement = objReference;
-
while (oElement != null && oElement.tagName != null && oElement.tagName != "BODY") {
-
if (oElement.tagName.toUpperCase() == nodeName && (className == null || oElement.className.search("\b"+className+"\b") != 1) ) {
-
return oElement;
-
}
-
oElement = oElement.parentNode;
-
}
-
return null;
-
}
-
-
function doColumnResize(th,event){
-
if(!event) event = window.event;
-
if( isOnBorderRight(th,event)){
-
overColumn=true;
-
th.style.cursor="e-resize";
-
}
-
else{
-
overColumn=false;
-
th.style.cursor="";
-
}
-
return overColumn;
-
}
-
-
function doTableResize(div,event){
-
if(!event) event = window.event;
-
-
if( isOnBorderBottom(div,event)){
-
div.style.cursor="move";
-
overTable=true;
-
}
-
else{
-
div.style.cursor="";
-
overTable=false;
-
}
-
return overTable;
-
}
-
-
function doneTableResizing(){
-
overTable=false;
-
}
-
-
function doneColumnResizing(){
-
overColumn=false;
-
}
-
-
function MD(event) {
-
if(!event) event = window.event;
-
-
MOUSTSTART_X=event.clientX;
-
MOUSTSTART_Y=event.clientY;
-
-
-
if (overColumn){
-
-
if(event.srcElement)objTh = event.srcElement;
-
else if(event.target)objTh = event.target;
-
else return;
-
-
objTh = getParentNode(objTh,"TH");
-
if(objTh == null) return;
-
objTable = getParentNode(objTh,"TABLE");
-
objThWidth=parseInt(objTh.style.width);
-
objTableWidth=parseInt(objTable.offsetWidth);
-
}
-
else if(overTable){
-
if(event.srcElement)objDiv = event.srcElement;
-
else if(event.target)objDiv = event.target;
-
else return;
-
-
objDiv = getParentNode(objDiv,"DIV","scrollable");
-
-
if(objDiv == null)return;
-
objDivHeight=objDiv.offsetHeight;
-
objTbodyHeight=objDiv.getElementsByTagName('TBODY')[0].offsetHeight;
-
}
-
}
-
-
function MM(event) {
-
if(!event) event = window.event;
-
-
if (objTh) {
-
var thSt=event.clientX-MOUSTSTART_X+objThWidth;
-
var tableSt=event.clientX-MOUSTSTART_X+objTableWidth;
-
-
/* check for minimum width */
-
if(thSt>=10){
-
objTh.style.width=thSt;
-
objTable.style.width=tableSt;
-
}
-
if(document.selection) document.selection.empty();
-
else if(window.getSelection)window.getSelection().removeAllRanges();
-
}
-
else if( objDiv ){
-
-
var divSt=event.clientY-MOUSTSTART_Y+objDivHeight;
-
var tbodySt = event.clientY-MOUSTSTART_Y+objTbodyHeight;
-
-
-
/* check for minimum height */
-
if(divSt >=70 ){
-
-
var tbody = objDiv.getElementsByTagName('TBODY')[0];
-
var table = objDiv.getElementsByTagName('TABLE')[0];
-
-
/* adjust the height for mozilla, this is not needed for IE */
-
if(tbodySt >= tbody.scrollHeight)tbodySt=tbody.scrollHeight;
-
tbody.style.height=tbodySt;
-
-
/* adjust the height for IE, this is not needed more Mozilla */
-
if(divSt >= table.scrollHeight)divSt=table.scrollHeight;
-
objDiv.style.height=divSt;
-
}
-
if(document.selection) document.selection.empty();
-
else if(window.getSelection)window.getSelection().removeAllRanges();
-
}
-
}
-
-
function MU(event) {
-
if(!event) event = window.event;
-
if(objTh){
-
if(document.selection) document.selection.empty();
-
else if(window.getSelection)window.getSelection().removeAllRanges();
-
objTh = null;
-
}
-
else if( objDiv ){
-
if(document.selection) document.selection.empty();
-
else if(window.getSelection)window.getSelection().removeAllRanges();
-
objDiv = null;
-
}
-
}
-
-
document.onmousedown = MD;
-
document.onmousemove = MM;
-
document.onmouseup = MU;
-
</script>
-
-
-
<SCRIPT type="text/javascript">
-
function createFindWindow(){
-
// FIXME: we need to do a mozilla implementation
-
//mozilla
-
if(window.find){
-
window.find();
-
}
-
// IE
-
else {
-
window.open( "find.html", "openload_find","status=yes,width=500,height=250" );
-
}
-
}
-
</script>
-
-
-
</HEAD>
-
-
<BODY>
-
<!--
-
YOU MUST HAVE TO DEFINE WIDTH ON STYLE TAB.. if you leave NULL
-
IT RETURNS .. ERROR..
-
-->
-
<H1>RESIZABLE TABLE COLUMN</H1>
-
<form>
-
<a href="javascript:createFindWindow()">Find</a>
-
-
<div class="scrollable" onmousemove="doTableResize(this,event)" onmouseover="doTableResize(this,event)" onmouseout="doneTableResizing()" >
-
<TABLE id="mytable" style="width:510px" class="sortable resizable tabular">
-
-
<THEAD>
-
-
<TR>
-
-
<TH onmousemove="doColumnResize(this,event)" onmouseover="doColumnResize(this,event)" onmouseout='doneColumnResizing()' style='width:60px'>Index</TH>
-
-
<TH onmousemove="doColumnResize(this,event)" onmouseover="doColumnResize(this,event)" onmouseout='doneColumnResizing()' style='width:170px'><span class="nowrap">Parameter Name</span></TH>
-
-
<TH onmousemove="doColumnResize(this,event)" onmouseover="doColumnResize(this,event)" onmouseout='doneColumnResizing()' style='width:170px'><span class="nowrap">Parameter Value</span></TH>
-
-
<TH onmousemove="doColumnResize(this,event)" onmouseover="doColumnResize(this,event)" onmouseout='doneColumnResizing()' style='width:110px'><span class="nowrap">Page Name</span></TH>
-
-
<TH class="sorttable_nosort scrollbarCol"></TH>
-
-
</TR>
-
</THEAD>
-
<TBODY style="height:200px">
-
<TR>
-
-
<TD>0</TD>
-
-
<TD>1_2</TD>
-
-
<TD><input type="text" value="this is a very long text string, this is a very long text string"></TD>
-
-
<TD>1_3</TD>
-
-
</TR>
-
-
<TR>
-
-
<TD>0</TD>
-
-
<TD>1_2</TD>
-
-
<TD><input type="text" value="this is a very long text string, this is a very long text string"></TD>
-
-
<TD>1_3</TD>
-
-
</TR>
-
-
<TR>
-
-
<TD>0</TD>
-
-
<TD>1_2</TD>
-
-
<TD><input type="text" value="this is a very long text string, this is a very long text string"></TD>
-
-
<TD>1_3</TD>
-
-
</TR>
-
<TR>
-
-
<TD>0</TD>
-
-
<TD>1_2</TD>
-
-
<TD><input type="text" value="this is a very long text string, this is a very long text string"></TD>
-
-
<TD>1_3</TD>
-
-
</TR>
-
<TR>
-
-
<TD>0</TD>
-
-
<TD>1_2</TD>
-
-
<TD><input type="text" value="this is a very long text string, this is a very long text string"></TD>
-
-
<TD>1_3</TD>
-
-
</TR>
-
<TR>
-
-
<TD>0</TD>
-
-
<TD>1_2</TD>
-
-
<TD><input type="text" value="this is a very long text string, this is a very long text string"></TD>
-
-
<TD>1_3</TD>
-
-
</TR>
-
<TR>
-
-
<TD>0</TD>
-
-
<TD>1_2</TD>
-
-
<TD><input type="text" value="this is a very long text string, this is a very long text string"></TD>
-
-
<TD>1_3</TD>
-
-
</TR>
-
<TR>
-
-
<TD>0</TD>
-
-
<TD>1_2</TD>
-
-
<TD><input type="text" value="this is a very long text string, this is a very long text string"></TD>
-
-
<TD>1_3</TD>
-
-
</TR>
-
-
<TR>
-
-
<TD>1</TD>
-
-
<TD><span class="nowrap">this is a very long paramter name</span></TD>
-
-
<TD>2_2</TD>
-
-
-
<TD>2_3</TD>
-
-
-
</TR>
-
-
-
<TR>
-
-
<TD>3_0</TD>
-
<TD>3_2</TD>
-
-
<TD><textarea>
-
this is a test of
-
this is a test of
-
</textarea></TD>
-
-
<TD>3_3</TD>
-
-
-
</TR>
-
-
-
<TR>
-
-
<TD>4_0</TD>
-
-
-
<TD>4_1</TD>
-
-
-
<TD>4_2</TD>
-
-
<TD>4_3</TD>
-
-
</TR>
-
-
</TBODY>
-
</table>
-
<!-- needed for mozilla to shrink the window -->
-
<script type="text/javascript">
-
if(window.navigator && window.navigator.userAgent.indexOf("ecko") != -1 ){
-
var tbody=document.getElementById('mytable').getElementsByTagName('tbody')[0];
-
if(tbody.scrollHeight<=parseInt(tbody.style.height)) tbody.style.height="auto";
-
}
-
</script>
-
</div>
-
-
</form>
-
</BODY>
-
</HTML>
find.html
------------------------------- - <HTML>
-
<HEAD>
-
<TITLE>Find/Replace</TITLE>
-
<script type="text/javascript">
-
<!--
-
var inputTags = null;
-
var found = false;
-
var currentInputIdx = 0;
-
var currentTextRange = null;
-
var currentSearchVal = null;
-
-
function initFind(){
-
inputTags = new Array();
-
var tags = opener.document.getElementsByTagName("input");
-
if(tags != null){
-
for(i = 0; i < tags.length;++i){
-
if(tags[i].type == "text"){
-
inputTags[inputTags.length] = tags[i];
-
}
-
}
-
}
-
-
tags = opener.document.getElementsByTagName("textarea");
-
if(tags != null){
-
for(i = 0; i < tags.length;++i){
-
inputTags[inputTags.length] = tags[i];
-
}
-
}
-
}
-
-
// returns a calculated value for matching case and
-
// matching whole words
-
function searchType(){
-
var retval = 0;
-
var matchcase = 0;
-
var matchword = 0;
-
if (document.forms[0]['blnMatchCase'].checked) matchcase = 4;
-
if (document.forms[0]['blnMatchWord'].checked) matchword = 2;
-
retval = matchcase + matchword;
-
return(retval);
-
}
-
-
function replaceText(){
-
-
// if no current tag then find one
-
if(currentTextRange == null) {
-
findText();
-
}
-
// if we have one then replace
-
else if(currentTextRange != null){
-
var beforeBookmark = currentTextRange.getBookmark();
-
var replaceStr = document.forms[0]['replaceStr'].value;
-
currentTextRange.text=replaceStr;
-
pushUndoNew(currentTextRange, beforeBookmark, currentSearchStr, replaceStr);
-
currentTextRange.collapse(false);
-
findText();
-
}
-
}
-
-
function replaceAllText(){
-
found = false;
-
if(currentTextRange == null) findText();
-
-
while(currentTextRange != null){
-
replaceText();
-
}
-
}
-
-
function findText(){
-
if(inputTags == null) initFind();
-
-
if (document.forms[0]['searchStr'].value.length < 1) {
-
alert("Please enter text in the \"Find what:\" field.");
-
return;
-
}
-
-
if(inputTags.length == 0){
-
alert("No input field(s) found on page");
-
return;
-
}
-
-
var searchVal = currentSearchStr = document.forms[0]['searchStr'].value;
-
-
var useRegex = document.forms[0]['blnRegex'].checked;
-
-
if( currentTextRange == null) {
-
currentTextRange = inputTags[currentInputIdx].createTextRange();
-
if(useRegex) currentText = currentTextRange.text;
-
}
-
else {
-
currentTextRange.collapse(false);
-
// get the remaining search range for regex
-
if(useRegex){
-
var rng = currentTextRange.duplicate();
-
rng.collapse(false);
-
rng.moveEnd("textedit");
-
currentText = rng.text;
-
}
-
-
}
-
-
var match = true;
-
-
if(useRegex){
-
try{
-
var matches = currentText.match(new RegExp(searchVal));
-
if(matches){
-
currentSearchStr = matches[0];
-
}
-
else {
-
match = false;
-
}
-
}
-
catch(e){
-
alert("Illegal Regex: '" + searchVal + "'");
-
return;
-
}
-
}
-
-
var type = searchType();
-
-
// found a match within the current text field
-
if( match && currentTextRange.findText(currentSearchStr, 10000, type)){
-
currentTextRange.select();
-
inputTags[currentInputIdx].scrollIntoView(false);
-
currentTextRange.scrollIntoView();
-
found = true;
-
}
-
// no match found and end of the document
-
else if( currentInputIdx >= inputTags.length-1 ){
-
currentTextRange = null;
-
currentInputIdx = 0;
-
if(found) alert("Done!");
-
else alert("Can not find '" +searchVal +"'");
-
found = false;
-
}
-
// no match found in the current text, look at the next text field
-
else{
-
currentTextRange = null;
-
++currentInputIdx;
-
findText();
-
}
-
}
-
-
// BEGIN UNDO BUFFER CODE
-
// buffer global variables
-
var undoStack = new Array();
-
-
// UndoState Object
-
function UndoState(textRange,searchStr,inputIdx,beforeBookmark, afterBookmark){
-
this.textRange = textRange;
-
this.searchStr = searchStr;
-
this.inputIdx = inputIdx;
-
/* two bookmarks are necessary to get back to the before and after state */
-
this.afterBookmark = afterBookmark;
-
this.beforeBookmark = beforeBookmark;
-
}
-
-
// store original search string and bookmarks of each replaced range
-
function pushUndoNew(rng, beforeBookmark,searchStr, replaceStr) {
-
currentTextRange.moveStart("character", -replaceStr.length);
-
undoStack[undoStack.length] = new UndoState( currentTextRange,searchStr,currentInputIdx,beforeBookmark,currentTextRange.getBookmark() );
-
}
-
-
// perform the undo
-
function undoReplace() {
-
if (undoStack.length) {
-
var newLength = undoStack.length-1;
-
currentTextRange = undoStack[newLength].textRange;
-
currentTextRange.moveToBookmark( undoStack[newLength].afterBookmark );
-
-
currentTextRange.text = undoStack[newLength].searchStr;
-
currentTextRange.moveToBookmark( undoStack[newLength].beforeBookmark );
-
-
// reselect the undo
-
currentTextRange.findText(undoStack[newLength].searchStr, 10000);
-
currentTextRange.select();
-
currentTextRange.scrollIntoView();
-
-
currentInputIdx = undoStack[newLength].inputIdx;
-
undoStack.length=newLength;
-
}
-
}
-
-
//-->
-
</script>
-
</HEAD>
-
<BODY bgcolor="#EAF4F3">
-
<FORM NAME="frmSearch" method="post" action="">
-
<table CELLSPACING="0" cellpadding="5" border="0">
-
<tr><td VALIGN="top" align="left" nowrap
-
style="font-family:Arial; font-size:11px;">
-
<label for="searchStr" accesskey="n"><u>F</u>ind what:</label><br>
-
<INPUT TYPE="TEXT" SIZE=40 NAME="searchStr"
-
id="searchStr" style="width:280px;"><br>
-
<label for="replaceStr" accesskey="n"><u>R</u>eplace with:</label><br>
-
<INPUT TYPE="TEXT" SIZE=40 NAME="replaceStr"
-
id="replaceStr" style="width:280px;"><br>
-
-
<INPUT TYPE="Checkbox" NAME="blnMatchCase" id="blnMatchCase">
-
<label for="blnMatchCase">Match case</label><br>
-
-
<INPUT TYPE="Checkbox" NAME="blnMatchWord" ID="blnMatchWord">
-
<label for="blnMatchWord">Match whole word only</label>
-
-
<INPUT TYPE="Checkbox" NAME="blnRegex" ID="blnRegex">
-
<label for="blnRegex">Use regular expression</label>
-
-
</td>
-
<td rowspan="2" valign="top">
-
<button name="btnFind" accesskey="f" onClick="findText();"
-
style="width:75px; height:22px; font-family:Tahoma;
-
font-size:11px; margin-top:15px"><u>F</u>ind Next</button><br>
-
-
<button name="btnReplace" accesskey="r" onClick="replaceText();"
-
style="width:75px; height:22px; font-family:Tahoma;
-
font-size:11px; margin-top:15px"><u>R</u>eplace</button>
-
-
<button name="btnReplaceAll" accesskey="a" onClick="replaceAllText();"
-
style="width:75px; height:22px; font-family:Tahoma;
-
font-size:11px; margin-top:15px">Replace <u>A</u>ll</button><br>
-
-
<button name="btnUndo" onClick="undoReplace();"
-
style="width:75px; height:22px; font-family:Tahoma;
-
font-size:11px; margin-top:15px">Undo</button><br>
-
-
<button name="btnCancel" onClick="window.close();"
-
style="width:75px; height:22px; font-family:Tahoma;
-
font-size:11px; margin-top:7px">Close</button><br>
-
</td></tr>
-
</table>
-
</FORM>
-
</BODY>
-
</HTML>
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,750
| | | re: resize columns in a table
Please use code tags when posting code:
[CODE=javascript]
JavaScript code within code tags
[/code]
If you find that the code doesn't appear for whatever reason, split it up into smaller chunks.
| | Newbie | | Join Date: Feb 2007
Posts: 2
| | | re: resize columns in a table
Thanks try this link [removed links]
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,750
| | | re: resize columns in a table
I have removed the links. They add nothing meaningful to the conversation and could be considered similar to spamming.
| | Newbie | | Join Date: Dec 2009
Posts: 5
| | | re: resize columns in a table
I have be very happy because from 2 days searching for table grid control with resizable columns.
So, got the code here.Everything is fine here but the problem is with mozilla/firefox which is not allowing to resize the columns.So, what i observed is that if i remove the doctype in the html page, it is working.But removing the doctype from my page disturbing the design of my page.So, i have to complete it fast as the time has been elapsed much in searching this widget.My project deadline is near.
So, Please help me out with some solution here ASAP.
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,750
| | | re: resize columns in a table
I haven't tested the code myself, but did none of the code posted earlier work in Firefox?
| | Newbie | | Join Date: Dec 2009
Posts: 5
| | | re: resize columns in a table
thanx for the response acoder.I thouhgt nobody might give reply but now i'm happy.
So, the normalised code written by SINCE has not been working in firefox but good in IE.The problem i observed is with DOCTYPE. If i remove the DOCTYPE from my page it is working in both IE and firefox.But removing DOCTYPE disturbing my form completely.So, please help me out in clearing out this problem.
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,750
| | | re: resize columns in a table
Which doctype are you using?
| | Newbie | | Join Date: Dec 2009
Posts: 5
| | | re: resize columns in a table - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml">
XMHTL DOCTYPE even other DOCTYPES like HTML or else any loosely DOCTYPED.But still the problem persists.
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,750
| | | re: resize columns in a table
I haven't got time to check/test the code, but without a doctype (which you should have), the code makes certain assumptions about the values which are incorrect when you have a doctype. The best thing would be to get a test page and check the values with/without a doctype.
| | Newbie | | Join Date: Dec 2009
Posts: 5
| | | re: resize columns in a table
When the table is dragged beyond the html width and the page is scrolled, we are unable to drag(resize) the column from that end. Even same bug appears in the Test Code, Thnks n Reply soon.
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,750
| | | re: resize columns in a table
I cannot vouch for the code. It was posted by someone with only 2 posts. I would suggest a rethink and good clean code based on: valid doctype, valid HTML/CSS, drag-drop functionality on the column (onmousedown, onmousemove and onmouseup).
|  | Similar JavaScript / Ajax / DHTML bytes | | | Forums
Visit our community forums for general discussions and latest on Bytes
/bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 229,155 network members.
|