You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de> on 2006/06/27 14:44:28 UTC

Tomahawk dataTable Problem - replacing standard dataTable with tomahawks one shows nothing

Hello.

I am new to JSF and doing some tutorials, reading docs and so on for
learning.
Reading corejsf Book and doing their examples i want to modifiy it for
learning purposes, so i've taken the chapter 5 tutorial and modified it
to use a resultsetmodel, which worked flawless.

The problem now is, if i replace h:dataTable with t:dataTable to use the
tomahawk one, only the table headers are rendered, the data is missing.

Leaving the h:tableData, it works.

Thats my index.jsp:

<html>
   <%@ taglib uri="http://java.sun.com/jsf/core"  prefix="f" %>
   <%@ taglib uri="http://java.sun.com/jsf/html"  prefix="h" %>
   <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
   <f:view>
      <head>
         <link href="styles.css" rel="stylesheet" type="text/css"/>
         <f:loadBundle basename="com.corejsf.messages" var="msgs"/>
         <title>
            <h:outputText value="#{msgs.pageTitle}"/>
         </title>
      </head>
      <body>
         <h:form>
            <t:dataTable value="#{tableData.customers}" var="customer" 
               styleClass="customers" preserveDataModel="true"
               headerClass="customersHeader"
columnClasses="custid,name">
               <h:column>
                  <f:facet name="header">
                     <h:outputText value="#{msgs.customerIdHeader}"/>
                  </f:facet>
                  <h:outputText value="#{customer.cust_ID}"/>
               </h:column>
               <h:column>
                  <f:facet name="header">
                        <h:outputText value="#{msgs.nameHeader}"/>
                  </f:facet>
                  <h:outputText value="#{customer.name}"/>
               </h:column>
               <h:column>
                  <f:facet name="header">
                     <h:outputText value="#{msgs.phoneHeader}"/>
                  </f:facet>
                  <h:outputText value="#{customer.phone_Number}"/>
               </h:column>
               <h:column>
                  <f:facet name="header">
                     <h:outputText value="#{msgs.addressHeader}"/>
                  </f:facet>
                  <h:outputText value="#{customer.street_Address}"/>
               </h:column>
               <h:column>
                  <f:facet name="header">
                     	<h:outputText value="#{msgs.cityHeader}"/>
                  </f:facet>
                  <h:outputText value="#{customer.city}"/>
               </h:column>
               <h:column>
                  <f:facet name="header">
                     <h:outputText value="#{msgs.stateHeader}"/>
                  </f:facet>
                  <h:outputText value="#{customer.state}"/>
               </h:column>
            </t:dataTable>
         </h:form>
      </body>
   </f:view>
</html>



Using h:dataTable instead of t:dataTable works.

Wheres the problem, reading the docs and looking at sortTable.java from
the examples, i thought replacing the original one with tomahawks should
work without any modification?
Tomcat logs are free from errors or warnings, i am using myfaces and
tomahawk 1.1.3.

kind regards 

Torsten


Re: Tomahawk dataTable Problem - replacing standard dataTable with tomahawks one shows nothing

Posted by Matthias Wessendorf <ma...@apache.org>.
> Thats the bug - so thx for help ;) i found it myself.

Good to hear ;-)


> kind regards
>
> Torsten
>
>
> -- 0 and 1. Now what could be so hard about that? --
>
>


-- 
Matthias Wessendorf
Aechterhoek 18
48282 Emsdetten
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Re: Tomahawk dataTable Problem - replacing standard dataTable with tomahawks one shows nothing

Posted by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>.
http://issues.apache.org/jira/browse/TOMAHAWK-89

Thats the bug - so thx for help ;) i found it myself.

kind regards

Torsten


-- 0 and 1. Now what could be so hard about that? --


Re: Tomahawk dataTable Problem - replacing standard dataTable with tomahawks one shows nothing

Posted by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>.
http://issues.apache.org/jira/browse/MYFACES-278

Might be the cause - but according to this report, it should have been
fixed in 1.1.3 - i am using latest 1.1.3 snapshot, but it doesnt work,
is it fixed or not in 1.1.3?

kind regards


Re: Tomahawk dataTable Problem - replacing standard dataTable with tomahawks one shows nothing

Posted by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>.
Investigated a little bit and tried other models. If i am using a
SortableModel made with an  ArrayDataModel with Customers supplied
statically in the Code it works, t:dataTable shows what i want to see.

But if i am going to use a SortableModel from a ResultSetDataModel to
get the Customers from a database table, only h:dataTable still works,
t:dataTable shows nothing.

Any things with this Model type to get it working with tomahawk extended
Table?

code which works with the tomahawk dataTable:

...
private Customer[] customers = {
		new Customer("1","Anna","034142","My Street","Leipzig","Sachsen"),	
		new Customer("2","Bert","014142","Ny
Street","Halle","Sachsen-Anhalt"),
	};

public TableData() { 
...
ArrayDataModel ar_model = new ArrayDataModel(customers);
filterModel = new SortableModel(ar_model);
...
}

code which doesnt work with tomahawks dataTable, but with the default
one:

public TableData() { 
			open();
			Statement stmt = conn
					.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
							ResultSet.CONCUR_UPDATABLE);
			ResultSet result = stmt.executeQuery("SELECT * FROM Customers");
			CachedRowSetImpl crs = new CachedRowSetImpl();
			crs.populate(result);
			ResultSetDataModel db_model = new
ResultSetDataModel(crs.getOriginal());
			filterModel = new SortableModel(db_model);
			close();
}

The database table was made with this sql script:

CREATE TABLE Customers (
   Cust_ID INT,
   Name CHAR(30),
   Phone_Number CHAR(15),
   Street_Address CHAR(30),
   City CHAR(30),
   State CHAR(15)
);

INSERT INTO Customers VALUES (1, 'William Dupont', '(652)488-9931',
   '801 Oak Street', 'Eugene', 'Nebraska');

INSERT INTO Customers VALUES (2, 'Anna Keeney', '(716)834-8772',
   '86 East Amherst Street', 'Buffalo', 'New York');

INSERT INTO Customers VALUES (3, 'Mariko Randor', '(451)842-8933',
   '923 Maple Street', 'Springfield', 'Tennessee');



Some hints would be nice.


kind regards

Torsten