Hi All,

It looks like I am experiencing a bug with Trinidad handling table ranges
and screwing JavaScript handlers.

Here is a simple page and a backing bean attached:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<f:view xmlns:f="http://java.sun.com/jsf/core";
        xmlns:tr="http://myfaces.apache.org/trinidad";
        xmlns:trh="http://myfaces.apache.org/trinidad/html";>
    <trh:html>
        <trh:head><title>TABLE BUG TEST CASE</title></trh:head>
        <trh:body>
            <tr:form id="frm_main">
                    <tr:inputText id="it_search"
                                  valueChangeListener="#{tblBug.doSearch}"
                                  onkeyup="if(event.keyCode == 13 )
alert('onkeyup');"/>
                    <tr:commandButton text="retrieve"/>
                    <tr:table id="tbl_result" rows="3"
value="#{tblBug.resultset}" var="row" partialTriggers=":it_search">
                        <tr:column > <tr:outputText value="#{row}"/>
</tr:column>
                    </tr:table>
            </tr:form>
        </trh:body>
    </trh:html>
</f:view>

The key thing to notice in the above is the JavaScript handler on
<tr:inputText>:
         onkeyup="if(event.keyCode == 13 ) alert('onkeyup');"

The script  shows up an alert box when ENTER pressed in IE (for other
browsers it might be needed to change "event.keyCode" to "event.which").

Here is the simple backing bean which returns result set of more than one
table range:

public class TblBugBean {
    private List<String> resultset;
    List list1 = new ArrayList(6);

    public TblBugBean() {
        for (int i=0;i<6;i++) list1.add(""+i+i+i+i+i);
    }

    public List<String> getResultset() {return resultset;}

    public void doSearch(ValueChangeEvent event){
        String dn = (String) event.getNewValue();
        resultset = new ArrayList(0);
        if (dn.equals("111")) resultset = list1;
    }

}

The test case:
1. If you type "111" and press ENTER in the form you will get the alert
displayed.
2. press button [retrieve]
3. The table displayed with 2 ranges and a navigation element.
4. BUG: Since the step 3, alert will never be displayed, no matter how hard
you press ENTER. :)))
JavaScript handler on <tr:inputText> never gets called anymore. The same
happens to any other elements with JavaScript handlers if there would be
any.

Any help with the above would be very  much appreciated.

---
Sincerely yours
Dmitry Barsukov

Reply via email to