wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Blank Line inserting in a table,when rows are added dynamically.can anyone help? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Blank Line inserting in a table,when rows are added dynamically.can anyone help?" Watch "Blank Line inserting in a table,when rows are added dynamically.can anyone help?" New topic
Author

Blank Line inserting in a table,when rows are added dynamically.can anyone help?

isabella swan
Greenhorn

Joined: Nov 19, 2010
Posts: 12
I have placed <div> within the <td> of the main table.
In the <div> i have a table, to which the rows are added dynamically.
when the rows are added , blank line is inserting in the <td> of the main table.

I have tried with style="display-inline;padding:0px". it dint work.
Can any one please suggest some solution.



Thanks in advance
Pawan Kr Gupta
Greenhorn

Joined: Nov 21, 2010
Posts: 26
you are using java script or iterating list using java.
isabella swan
Greenhorn

Joined: Nov 19, 2010
Posts: 12
Pawan Kr Gupta wrote:you are using java script or iterating list using java.


am using javascript
Pawan Kr Gupta
Greenhorn

Joined: Nov 21, 2010
Posts: 26
Please refer the below code

function addRow()
{

var tbody = document.getElementById("table1").getElementsByTagName("tbody")[0];
var row = document.createElement("TR");
var cell1 = document.createElement("TD");
var cell2 = document.createElement("TD");
var cell3 = document.createElement("TD");
cell3.setAttribute("align","right");
var cell4 = document.createElement("TD");
cell4.setAttribute("align","right");
var cell5 = document.createElement("TD");
var cell6 = document.createElement("TD");
cell6.setAttribute("align","right");
var cell7 = document.createElement("TD");
var cell8 = document.createElement("TD");
var cell9 = document.createElement("TD");
var cell10 = document.createElement("TD");

cell1.innerHTML = "<td><input type=RADIO name=checkBoxTest onclick=modifynRemove(this,"+gRowId+"); ></td>";
cell2.innerHTML = "<td ><input type=text name= instrumentType"+gRowId+" readonly=true tabindex=-1 style=text-align:left;background-color:transparent value=\""+document.SAF_CallingForm.instrumentType.options[document.SAF_CallingForm.instrumentType.selectedIndex].text+"\" style=border:0><input type=hidden name= hdinstrumentType"+gRowId+" value="+document.SAF_CallingForm.instrumentType.options[document.SAF_CallingForm.instrumentType.selectedIndex].value+" ></td>" ;
cell3.innerHTML = "<td ><input type=text name= chequeDDDate"+gRowId+" readonly=true tabindex=-1 value=\""+document.SAF_CallingForm.chequeDDDate.value+"\" style=border:0;text-align:center;background-color:transparent></td>" ;
cell4.innerHTML = "<td ><input type=text name= amount"+gRowId+" readonly=true tabindex=-1 value=\""+document.SAF_CallingForm.amount.value+"\" style=border:0;text-align:right;background-color:transparent><input type=hidden name= hdAmount"+gRowId+" value="+document.SAF_CallingForm.amount.value+" ></td>" ;
cell5.innerHTML = "<td ><input type=text name= lbxcashAccount"+gRowId+" readonly=true tabindex=-1 value=\""+document.SAF_CallingForm.lbxcashAccount.value+"\" style=border:0;text-align:left;background-color:transparent></td>" ;
cell6.innerHTML = "<td ><input type=text name= chequeddno"+gRowId+" readonly=true tabindex=-1 style=text-align:right;background-color:transparent value=\""+document.SAF_CallingForm.chequeddno.value+"\" style=border:0></td>" ;
cell7.innerHTML = "<td ><input type=text name= infavourof"+gRowId+" readonly=true tabindex=-1 style=text-align:left;background-color:transparent value=\""+document.SAF_CallingForm.infavourof.value+"\" style=border:0></td>" ;
cell8.innerHTML = "<td ><input type=text name= payableat"+gRowId+" readonly=true tabindex=-1 style=text-align:left;background-color:transparent value=\""+document.SAF_CallingForm.showlbxpayableat.value+"\" style=border:0><input type=hidden name= hdpayableat"+gRowId+" value="+document.SAF_CallingForm.lbxpayableat.value+" ></td>" ;
cell9.innerHTML = "<td ><input type=text name= Drawnon"+gRowId+" readonly=true tabindex=-1 style=text-align:left;width:180px;background-color:transparent value=\""+document.SAF_CallingForm.showlbxDrawnon.value+"\" style=border:0><input type=hidden name= hdDrawnon"+gRowId+" value="+document.SAF_CallingForm.lbxDrawnon.value+" ></td>" ;
cell10.innerHTML = "<td ><input type=text name= reason"+gRowId+" readonly=true tabindex=-1 style=text-align:left;background-color:transparent value=\""+document.SAF_CallingForm.reason.value+"\" style=border:0></td>" ;

row.appendChild(cell1);
row.appendChild(cell2);
row.appendChild(cell3);
row.appendChild(cell4);
row.appendChild(cell5);
row.appendChild(cell6);
row.appendChild(cell7);
row.appendChild(cell8);
row.appendChild(cell9);
row.appendChild(cell10);

tbody.appendChild(row);


}
isabella swan
Greenhorn

Joined: Nov 19, 2010
Posts: 12
Thanks a lot for your help.

Actually i could figure out that table was moving down, when the rows are added.
I could fix wit style="position: absolute;" on the main table.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
This code here:



is totally wrong.

It means your html would look like



Eric
 
 
subject: Blank Line inserting in a table,when rows are added dynamically.can anyone help?
 
Similar Threads
Scrollable Table using DIV in IE7 not working as expected
performance issue with DIV tags
Iterate through multiple arrays
Regarding Div tag and Table header being scrolled
cellspacing - html javascript css issue