Detecting Distance From Top Of Window In Order To Hide Table Rows?
May 1, 2011
I am doing some work, where I want to have a table heading that remains in a fixed position, when the window is scrolled (I will ultimately have a very long table). I have written the code below, which fixes the heading.
I am trying to make it so that each body row of the table gets hidden, when the window is scrolled such that the row passes above the heading row.
To do this I need to somehow detect the distance of each row from the top of the window as the window is scrolled so I can detect when it goes above the fixed heading row. I have tried to do this using offsetTop and scrollTop in the code below, but it doesn't seem to be working (in Safari at least, which I am using for my main testing).
Does anyone know a simple way of detecting the distance to the top of the window so I can use it in my code below, which will work in all browsers?
(I don't really want to use div, and overflow-y:auto to achieve the fixed heading scrollable table, because I don't want to have a sub-section with its own scrollbar. I just want to have the main page scrollbar when the list gets long enough to require it.)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
[Code]....
View 2 Replies
ADVERTISEMENT
May 28, 2011
I use PHP to create an HTML table with information from a database, ordered by date. Some of the rows of the table have a class named "new", while the others don't have any class. What I would like to do is to have all the rows with class "new" shown as last rows of that specific date.
So for example:
Code:
<tr>...<td>01-01-2011</td>...</tr>
<tr>...<td>01-01-2011</td>...</tr>
<tr class="new">...<td>01-01-2011</td>...</tr>
<tr class="new">...<td>01-01-2011</td>...</tr>
Is this possible using javascript/jquery?
View 7 Replies
View Related
Jul 23, 2005
I try to group several rows in a table into a div and show/hide them by
click on a button somewhere with a javascript link. When clicked, the link
will toggle the style of the div section's style between BLOCK and NONE.
This technique works on normal text fine, but it doesn't work on part of the
table, is there a solution that I can achieve the goal of turning on/off
several rows all together?
View 9 Replies
View Related
Mar 15, 2011
I ahve this table as code shown below with buttons Up and down above and below the table respectively now whgat i want to do is that as I have ten enteries in the table.I want to show only 6 of them at one go on a page and the rest 4 should be hidden and when I cliock the "down" button the next four should be displayed and vice versa when I click "up" button the first 6 should be displayed.
Code:
<div >
<input type="button" id="up" value="up"/>[code]....
View 2 Replies
View Related
Aug 24, 2011
I want to hide duplicate rows in a html table.
View 3 Replies
View Related
May 4, 2011
I have a table that is set up to look like a menu and would like to show/hide certain rows, the problem is that the rows do not have id's...basically, it looks like this:
<table class="mainTable">
<tbody>
<tr><td class="Level1 Selected"><a href="page1.aspx">Page 1</a></td></tr>[code]....
Ultimately, what I would like to do is: show all Level1 rows.hideadditionallevels below Level1 (which could be any number deep)
and finally, if row is selected then show additional levels below (td class will change to "Selected" when on the page) and above (ie. if Level2 is selected).
View 4 Replies
View Related
Aug 16, 2010
I have a query regarding the hide/show of the cells in a table.The first column is 'Yes and No' options using combo box, 2nd option is 'input field', 3rd column is also 'Yes and No' option using combo box, and 4th option is also 'input field'.What I want is to make a table using JAVASCRIPT, in which if i select 'No' from the first row first column, i want to hide the remaining 3 cells of the first row. Otherwise if i select 'yes' from the first row first column i want to show all the 3 other options of the first row. Also in between if I select 'No' from the first row third column i want to hide the first row fourth column cell. Selecting 'yes' from the first row third column will show the first row fourth column.I want apply the same setting of hide and show cells into the remaining columns also.
By selecting 'no' from first column -> hide other corresponding cells of the row by selecting 'yes' from the first column -> show other corresponding cells of the row
AND ALSO
By selecting 'no' from third column -> hide fourth cell of the corresponding/same row by selecting 'yes' from the third column -> show fourth cell of the corresponding/same row
I have posted this question in the tablular form, but it is now showing in the proper format. Anyone in the forum please help me to make this table using JAVASCRIPT. I need this table within a day or two.
View 3 Replies
View Related
Sep 2, 2010
I've got a table that I want to be able to show/hide rows based on what check box is checked. By default, I don't want anything displayed, then if you check a or some of the check boxes you'll see the data.Here is what I have, which has some effect in FF but does not work at all in IE.This is my script (which is part mine, part web-found)
<style type="text/css">
.this {
display: none;[code]......
View 3 Replies
View Related
May 4, 2009
I am generated some HTML / Javascript through the use of some XSLT, and what I aim to do is generate a table with many rows where we always have the 1st row showing (which has a +/- image there for users to click so that they can expand/collapse the rest of the rows in that table). I am having trouble with the Javascript on assigning the relevant class to the rows so that they get hidden or shown.So far my XSL is outputting the following...
HTML Code:
<table class="InfoBlock" cellspacing="0" cellpadding="0">
<col class="report_column_headings">[code]...
I know I am violating HTML here by having many tags with the same ID, but I am just looking for ways to get this to work.what I place in my 'ShowHide()' javascript method?
View 1 Replies
View Related
May 27, 2009
is it possible to have several rows in a table with the same id so i can show/hide them in a block?I have also tried adding a span around the block of rows but that doesn't work ( I seem to remember you cant hava a span around TR tags?)
View 4 Replies
View Related
Jan 6, 2006
I've tried some methods mentioned in other topics here, but I can't seem to get any of them to work for this specific problem I have. I'm not very experienced in javascript so I haven't been able to modify any of the other examples to work the way I need it to.
I hope the code gives you some idea of what I need even though it's a bit messy, I think most of it should be pretty self explanatory? Code:
View 4 Replies
View Related
Nov 11, 2007
I use JS to show/hide a <tr> row but, when I do that, the content show or hide but there still have the space they use to took while visible. In short, the table did not update himself.
Any one have already got this problem or know the solution?
View 1 Replies
View Related
Dec 28, 2010
wrote me jvascript code for show/hide table rows.The situation is:
<table 1>
row 1
row 2
row 3[code]...
row 1 and row 4 are in one looping
row 2, row 3 ,row 5 and row 6 are in another one looping.The picture is like this:
1.when page load..
2.only row 1 and row 4 display
3.when row 1 is clicked row 2 and 3 will display
4.when row 4 is clicked row 5 and 6 will display
View 2 Replies
View Related
Jun 14, 2011
I have a table that contains many rows, some in italian with code <td nome='riga_i'>. and some in english with code <td name='row_e'>. I have created two buttons with different background flags: italy and uk, so when one pushes the button with flag uk, the html page will be reloaded with only english rows, and when one pushes the button with flag it, the same page is reloaded containing only italian rows. All the code posted here works well, but I think that the code can be better because to reach this result I had to dupplicate the same function and I don' t like this.
Here the code:
To better the code I have tried in this way but without success ...
View 2 Replies
View Related
Jul 20, 2005
I'm trying to get the following script to work, but I'm getting an error saying "rowID is undefined".
function showhide(rowId) {
var showRow = "Edit_" + rowID
var hideRow = "View_" + rowID
document.getElementById(showRow).style.display ="block";
document.getElementById(hideRow).style.display = "none";
}
I'm building the html using an xsl stylesheet, so I'm passing a
dynamic name attribute as the rowID parameter. When I look at the HTML
source, it looks fine. Please tell me where I'm going wrong...I'm sure
it's simple, just not to me! Thanks, Kathy
Here is a sample of the row source:
<tr id="View_Label" bgcolor="red" valign="middle"
style="display:block">
<td width="70%"><h3>1.*Label</h3></td>
<td width="30%">
<input type="button" name="Edit" value="Edit"
</tr>
....then another row with ="Edit_Label" is used for the input boxes,etc.
View 2 Replies
View Related
Oct 21, 2011
Say, for example, I have a table with an undefined number of rows. Row 1 contains number 1 to 10, row 2 contains 11 to 20... you get the picture. The table is autogenerated and id's are made unique by the system (GUID's plus id). I am able to add a 'name'attribute to'img''sthat are in the td's and add a groupname i.e. '11to20'. Using this i want to test showing/hiding grouprows. Now I have a dropdownlist on the page where the user selects the groupname from
i.e."11to20". I would like to be able to hide the rows not having the selected groupname
and show the rows that do. I've constructed a query that would hide the selected groupname but it hides all tr's.
$(obj).attr('name', obj.options[obj.selectedIndex].value).parents('tr').siblings().fadeOut('fast');
Here's the (simplified) sample html I constructed by hand for this message:
<fieldset class="my-form"><div>
<div class="NumberSelector"">
<label for="ChooseNumber">Choose a number</label>
<table id="ChooseNumber" cellspacing="10" border="0" style="width:542px;">
<tr><td><label for="ChooseNumber_1">
<img name="1To10" src="/images/number1.jpg" alt="number1" onclick="ImagePopup(this);"/> .....
View 3 Replies
View Related
May 3, 2011
How can I use jquery to cycle through all the table rows I have in a table, and hide the rows that contain a specific HTML value that I pass to jquery?For instance, I have a table full of students, and courses each student is taking. If I want to hide all the rows where the course is Chemistry (regardless of student), how would I do that?I already have captured the HTML value, what I mainly need help with is how to tell jquery to hide ALL of the rows with that HTML value, rather than just the row I click on.
View 1 Replies
View Related
Jan 7, 2010
I want to hide/show table rows with an onclick event. Here are the relevant snippets of code I have:
Script:
$(document).ready(function() {
$("#plan1-title").click(function() {
$("#plan1").toggle();
[code]....
It works in all browsers (Firefox, Safari, Chrome, and Opera), however not a single version of IE 6-8 will toggle the table row.
View 2 Replies
View Related
Feb 15, 2006
I am maintaining a site which is written in ASP. Now i have to create
some new pages.
In one page we have a table with many rows. Now, I want to enable or
disable(showing and hiding also) 2 rows of this table depending upon
the value selected by the user from a drop down list.
View 4 Replies
View Related
Jun 13, 2011
I have a table that contains many rows, some in italian with code <td nome='riga_i'> and some in english with code <td name='row_e'>. I have created two buttons with different background flags: italy and uk, so when one pushes the button with flag uk, the html page will be reloaded with only english rows, and when one pushes the button with flag it, the same page is reloaded containing only italian rows. All the code posted here works well, but I think that the code can be better because to reach this result I had to dupplicate the same function and I don' t like this.
Here the code:
To better the code I have tried in this way but without success ...
View 1 Replies
View Related
May 1, 2009
i'm creating a ASP page, which is going to have a form in it that needs filling out. part of the form will be a table with a header row, then the next rows will have text boxes that need filling out. is there a way of putting in a dropdown box that contatins numbers that will dynamically show the rows. for example if i select 5, then five rows of text boxes will appear. if i select 14 then 14 appear.
View 3 Replies
View Related
May 3, 2010
I have some JQuery that makes an Ajax call and then adds some rows to an existing table.
function
LoadDestinationTable() {
$("#destinationTable tr:gt(0)"[code]...
The problem is that the only place where the click event fires is on the rows that were added when the page was 1st rendered – the th, for example.I also tried adding an onclick event handler to the input button’s creation – that also does not fire.
View 1 Replies
View Related
Jun 6, 2011
I have a need to select all table rows in the outer table of a cascading table structure, that is a table with contained tables. I tried to use the "Context" section of jQuery, but the table rows of the sub tables are being selected as well.
View 1 Replies
View Related
Feb 3, 2011
I have a site with 2 side by side tables with matching data. The left table is a drag-n-drop implementation so you can reorder the values in the database just by dragging and dropping. It works wonderfully. I want the right table to reflect the changes instantaneously. I got the right table to reload itself with the following jquery line:
$("#newMeet").load(location.href+" #newMeet>*","");
I stuck that line in the "Update" function of my "Sortable" funtion. And the line that I am using to initially stripe the right table is:
$(".checks2:even").addClass("grayBack");
Now matter where I stick that line, I cannot get the table re-striped after it reloads.
View 2 Replies
View Related
Jun 7, 2010
I have a dynamic HTML table which gets populated by coldfusion and displayed in the page, I have a column called performace which holds numeric values. I need to select the top 3 best performace value in the column and then highlight the entire row in different colours (top 3 values for performance). Can any one help me in doing it?My server can run only Javascript and coldfusion, No Ajax/PHP.I need a complete set of code which such that I will add the script and it performs the calculating and highlighting part.
View 1 Replies
View Related
Feb 9, 2011
Can I use script to remove the 2nd and 3rd table row elements from this html?
Code:
<table id="dap_product_links_table">
<tr>
<td><span class="scriptheader">Product Title</span></td>[code].....
View 3 Replies
View Related