<%@ include file="inc/header.jsp" %>
<% Object foo = session.getAttribute( "stest" ); if( foo == null ) { session.setAttribute( "stest", new TestList( 10, false ) ); } %>
<style type="text/css">
div.tableBody {
width: 80%;
overflow: auto;
height: 100px;
text-align: center;
padding: 0;
border: 1px solid #666;
border-top: 0;
margin-top: -20px;
}
div.tableBody table {
width: 99%;
margin: 0;
border: 0;
}
th, td {
width: 25%;
}
</style>
<h2><a href="./index.jsp">Examples</a> > Static Headers in IE</h2><display:table name="sessionScope.stest" defaultsort="1">
<display:column property="id" title="ID" sortable="true" headerClass="sortable" />
<display:column property="name" sortable="true" headerClass="sortable"/>
<display:column property="email" />
<display:column property="status" sortable="true" headerClass="sortable"/>
</display:table>
<script language="text/javascript">
// body of the page, for appending the <div> to separate the tables
var body = document.getElementById("body");
// get the table
var table = document.getElementsByTagName("table")[0];
// get the tbody of the table and set it's style programmatically
var tbody = document.getElementsByTagName("tbody")[0];
// remove the tbody - we'll add it back in later
table.removeChild(tbody);
// create a new div
var div = document.createElement("div");
// set the CSS class name
div.className="tableBody";
// create a title to hold the data (tbody)
var table2 = document.createElement("table");
table2.appendChild(tbody);
div.appendChild(table2);
body.appendChild(div);
</script>
<%@ include file="inc/footer.jsp" %>On Dec 5, 2003, at 9:25 AM, Matt Raible wrote:
What version of the displaytag are you using? This only works with the latest 1.0 betas.
Matt
On Dec 5, 2003, at 8:22 AM, Mehta, Jasmin wrote:
Hi Matt,
It didn't work with <display:table>. Here is my code: (Also, I don't want to call the javascript function staticheader() onclick of some hyperlink, I want that to be done when the page is loaded or loadin. How can I do that?)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/tags/struts-html" prefix="html" %> <%@ taglib uri="/tags/struts-bean" prefix="bean" %> <%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/WEB-INF/lib/displaytag.tld" prefix="display" %>
<%@ page import="java.util.ArrayList" %> <html> <head> <title>Project Tracking</title>
<script type="text/javascript">
function staticheader() { // body of the page, for appending the <div> to separate the tables var body = document.getElementsByTagName("body")[0]; // get the table var table = document.getElementsByTagName("table")[0]; // get the tbody of the table and set it's style programmatically var tbody = document.getElementsByTagName("tbody")[0]; // remove the tbody - we'll add it back in later table.removeChild(tbody); // create a new div var div = document.createElement("div"); // set the CSS class name div.className="tableBody"; // create a title to hold the data (tbody) var table2 = document.createElement("table"); table2.appendChild(tbody); div.appendChild(table2); body.appendChild(div); }
</script>
</head> <!-- START BODY HERE --> <BODY>
<a href="javascript://"onclick="staticheader()">click here</a>
<display:table name="sessionScope.projectList">
<display:column property="projectName" title="Project Name" sort="true"/>
<display:column property="crNbr" title="CR#" sort="true"/>
</display:table>
</body> </html>
Can you pl verify.
Thanks Jasmin -----Original Message----- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 7:01 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [displaytag-user] Static Headers - Updated HowTo
I did a quick hack today and came up with a solution for static headers
in IE and Mozilla. It's ugly, but it works:
http://homepage.mac.com/mraible/demos/staticHeaders.html
Matt
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user
smime.p7s
Description: S/MIME cryptographic signature

