This appears to be a feature of IE JavaScript. I am running IE 6.0
with the latest patches from Microsoft. Are there any workarounds
other than re-coding the source HTML to place all the non-visible
columns at the front?
I have a page with a dynamic table. The table has some visible columns
and some non-visible columns. The style "hide" is .hide {
display:none; }
<table id="SelectedLis t">
<tr class="columnhe ader">
<td>Value</td>
<td class="hide">Co de</td>
<td class="hide">Ty pe</td>
</tr>
</table>
When I add rows to this table, the order of the columns depends on
whether the hidden columns are at the beginning or end of the row.
Here is the resulting HTML for the table. Note how in the second case,
the order of the last two columns is reversed even though the function
adds them in order: column1, column2, column3.
<TBODY>
<TR class=columnhea der>
<TD class=hide>Code </TD>
<TD class=hide>Type </TD>
<TD class="">Value</TD></TR>
<TR>
<TD class=hide>colu mn1</TD>
<TD class=hide>colu mn2</TD>
<TD>column3</TD></TR>
<TR>
<TD>column1</TD>
<TD class=hide>colu mn3</TD>
<TD class=hide>colu mn2</TD></TR></TBODY>
addItem('Select edList');
function addItem(gridID)
{
var grid = document.getEle mentById(gridID );
// Test #1: first two columns hidden, las column visible
var row1 = grid.insertRow( grid.rows.lengt h);
for (i=0;i<3;i++)
{
cell = row1.insertCell (i);
if (i==0) cell.innerHTML = "column1"; //document.test.c ode.value;
else if (i==1) cell.innerHTML = "column2";
//document.test.c ateg.value;
else cell.innerHTML = "column3"; //document.test.v al.value;
if (i!=2) cell.className = "hide";
}
// Test #2: first column visible, last two hidden
var row2 = grid.insertRow( grid.rows.lengt h);
for (i=0;i<3;i++)
{
cell = row2.insertCell (i);
if (i==0) cell.innerHTML = "column1"; //document.test.c ode.value;
else if (i==1) cell.innerHTML = "column2";
//document.test.c ateg.value;
else cell.innerHTML = "column3"; //document.test.v al.value;
if (i!=0) cell.className = "hide";
}
//document.test.t blhtml.value = grid.innerHTML;
alert(grid.inne rHTML);
} 2 4964 ds********@yaho o.com wrote: This appears to be a feature of IE JavaScript. I am running IE 6.0 with the latest patches from Microsoft. Are there any workarounds other than re-coding the source HTML to place all the non-visible columns at the front?
I have a page with a dynamic table. The table has some visible columns and some non-visible columns. The style "hide" is .hide { display:none; }
<table id="SelectedLis t"> <tr class="columnhe ader"> <td>Value</td> <td class="hide">Co de</td> <td class="hide">Ty pe</td> </tr> </table>
When I add rows to this table, the order of the columns depends on whether the hidden columns are at the beginning or end of the row. Here is the resulting HTML for the table. Note how in the second case, the order of the last two columns is reversed even though the function adds them in order: column1, column2, column3.
Yup, same result here. You can fix two ways: add the cells in one loop,
then hide them using a separate loop, or use createElement and add them
that way (see below): <TBODY> <TR class=columnhea der> <TD class=hide>Code </TD> <TD class=hide>Type </TD> <TD class="">Value</TD></TR> <TR> <TD class=hide>colu mn1</TD> <TD class=hide>colu mn2</TD> <TD>column3</TD></TR> <TR> <TD>column1</TD> <TD class=hide>colu mn3</TD> <TD class=hide>colu mn2</TD></TR></TBODY>
addItem('Select edList'); function addItem(gridID) { var grid = document.getEle mentById(gridID );
// Test #1: first two columns hidden, las column visible var row1 = grid.insertRow( grid.rows.lengt h); for (i=0;i<3;i++) { cell = row1.insertCell (i);
if (i==0) cell.innerHTML = "column1"; //document.test.c ode.value; else if (i==1) cell.innerHTML = "column2"; //document.test.c ateg.value; else cell.innerHTML = "column3"; //document.test.v al.value;
The whole if..else bit can be replaced with:
cell.appendChil d(document.crea teTextNode("col umn" + (i+1))); if (i!=2) cell.className = "hide"; }
// Test #2: first column visible, last two hidden var row2 = grid.insertRow( grid.rows.lengt h);
Replace from here:
for (i=0;i<3;i++) { cell = row2.insertCell (i); if (i==0) cell.innerHTML = "column1"; //document.test.c ode.value; else if (i==1) cell.innerHTML = "column2"; //document.test.c ateg.value; else cell.innerHTML = "column3"; //document.test.v al.value;
if (i!=0) cell.className = "hide"; }
to here with either the following createElement solution:
for (var i=0; i<3; i++)
{
cell = document.create Element('td');
cell.appendChil d(document.crea teTextNode("col umn" + (i+1)));
row2.appendChil d(cell);
if (i!=0) cell.className = "hide";
}
Or this 2 loop solution:
for (var i=0; i<3; i++)
{
cell = row2.insertCell (i);
cell.appendChil d(document.crea teTextNode("col umn" + (i+1)));
}
for (var j=1, len=row2.length ; j<len ; ++j){
row2.cells[j].className = "hide";
} //document.test.t blhtml.value = grid.innerHTML; alert(grid.inne rHTML); }
--
Rob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Not Me |
last post by:
Hi,
I'm sure this is a common problem.. to create a single field from a
whole column, where each row would be separated by a comma.
I can do this for a specified table, and column.. and I've created a
function using VBA to achieve a more dynamic (and very slow) solution..
so I would like to implement it using a user defined function in sql server.
The problems I'm facing are, that I can't use dynamic sql in a
|
by: muzamil |
last post by:
Hi
Your help for the following query will be highly apprecaited. I've
wasted alot of time on it. Data definition is at the bottom.
Thanks
-----------------------------------
|
by: Robert Stearns |
last post by:
Either I missed something, or ALTER TABLE does not have this
capability. Is there any way of doing it except
DROPping all constraints which mention this table,
EXPORTing the data,
DROPping the table,
reCREATEing the table without the 'NOT NULL property,
reCREATEing the INDEXes,
reloading the data,
redefining all of DROPped constraints
reCREATE the view which were marked inactive by the above.
|
by: Joe |
last post by:
Hi All,
I am new to using the Access DB and I need some help if someone
is able to give it to me. What I want to do is get the names of
the columns of certain tables. Not the data in the table but the
table column names.
I've seen other posts that suggest using the SQL command DESCRIBE
but I can't get it to work for some reason. Other posts have code
samples but they're written in VB which I am not familiar with. I
|
by: Geoff Jones |
last post by:
Hi
Can anybody help me with the following, hopefully simple, question?
I have a table which I've connected to a dataset. I wish to add a new column
to the beginning of the table
and to fill it with incremental values e.g. if the tables looks
like this:
23 56
| |
by: cavassinif |
last post by:
I need to dynamic select a column in which insert a vale based on a
parameter value, I have this code, but it throws an incorrect syntax
error.
How do I dinamically select a column to insert based on a parameter?
Create PROCEDURE dbo.UpdateDetalleOT (
@eotId int,
)
|
by: Steve |
last post by:
I realize that this probably isn't a best practice, but I'm working with
legacy code that has a query stored in one column of a table. Because
the queries vary, the JSP page that selects a query and runs it cannot
add any additional information (like a WHERE clause).
I need to add a few more records to the the table, and would like the
query to include a value from another field in the current row in a
WHERE clause -- something like...
|
by: annecarterfredi |
last post by:
I'd like to add a new column to an existing table at a specific column
location...
Existing table definition:
MyTable(Col1, Col2, Col3)
I want to add a new column in MyTable and the new column's position is
in between Col2 and Col3:
MyTable(Col1, Col2, New_Column, Col3)
|
by: tjc0ol |
last post by:
Hi guys,
I'm a newbie in php and I got error in my index.php which is:
1054 - Unknown column 'p.products_id' in 'on clause'
select p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd,...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |