Which version of tomahawk are you using?

On 5/3/07, Shane Petroff <[EMAIL PROTECTED]> wrote:
Gerald Müllan wrote:
>
> have you considered to use s:filterTable from sandbox?
> ...
> http://example.irian.at/example-sandbox-20070502/filterTable.jsf
(derailing the thread slightly)

Thanks for the reference, but I would love some help to get FilterTable
working. I've copied/pasted the example code into a page of mine, and
the java code into the backing bean. Everything renders fine, and the
table is sortable, but the function dojo.widget.byId returns null, so
the filter functions do not work. I've tried using dojo.widget.byId on
other named components, but it always seems to fail. Is there something
that needs to be configured or initialized before byId can work? I'm
using tomahawk sandbox 1.1.6 snapshot jar alongside the 1.1.5 release.
The only difference I can see in the page is that I've nested the
FilterTable inside a form. The page is attached below.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<%@ 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"%>
<%@ taglib uri="http://myfaces.apache.org/sandbox"; prefix="s"%>

<f:loadBundle basename="mytResource" var="bundle"/>

<f:view>
<html>
  <head>

    <title>
      <h:outputText value="#{bundle.PickSectionTitle}"/>
    </title>

    <link rel="stylesheet" type="text/css" href="<%=
request.getContextPath() %>/stylesheet.css"/>

    <script type="text/javascript">
      function manufacturerFilter(name){
        return (name.charAt(0) >= 'M' && name.charAt(0) <= 'Z');
      }
    </script>
  </head>

<body class="page-background">


<h:form>

  <h:panelGrid headerClass="page-header" styleClass="panel"
               columns="1" cellpadding="5">

    <h:panelGrid headerClass="page-header" styleClass="panel"
               columns="1" cellpadding="5" align="right">
      <h:commandLink action="#{pickSectionBean.logout}"
value="#{bundle.Logout}"/>
    </h:panelGrid>

    <%-- Header --%>
    <f:facet name="header">
      <h:outputText value="#{pickSectionBean.headerValue}"/>
    </f:facet>

    <h:messages globalOnly="true" styleClass="errors"/>

    <h:commandButton id="startActionListener" value="#{bundle.Home}"
action="#{pickSectionBean.onHome}" styleClass="button"/>

    <f:verbatim>
        <input type="button" value="Show only manufacturers between M
and Z" onclick="dojo.widget.byId('filterTbl').setFilter('manufacturer',
manufacturerFilter);" />
        <input type="button" value="Clear Filters"
onclick="alert(dojo.widget.byId('filterTbl'));dojo.widget.byId('filterTbl').clearFilters()"
/>
    </f:verbatim>
    <s:filterTable id="filterTbl" var="car"
value="#{pickSectionBean.cars}" >
        <s:sortableColumn field="id" dataType="Number" text="Id">
            <h:outputText value="#{car.id}" />
        </s:sortableColumn>
        <s:sortableColumn field="manufacturer" text="Manufacturer">
            <h:outputText value="#{car.manufacturer}" />
        </s:sortableColumn>
        <s:sortableColumn field="model" text="Model">
            <h:outputText value="#{car.model}" />
        </s:sortableColumn>
    </s:filterTable>

  </h:panelGrid>

</h:form>
</body>
</html>
</f:view>

--
Shane






--
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to