You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by José Paumard <Jo...@orange.fr> on 2008/12/16 10:26:20 UTC

Searchable grid question

Hello all,

I have a pretty basic problem to solve, but I'm stuck with a 
"no-solution" and would ne happy to get hints from the list.

I would like to write a "searchable grid" component. It's a plain T5 
grid, with a first line made of textdields, instrumented with 
autocomplete mixins. When one types in something in a textfield, the 
autocompleter provides him with the relevant values in the columns, a 
very classical behavior.

Now I rewrote the Grid.tml to add this table line. The cellList property 
is just the getGridModel().getPropertyNames(), and T5 is happy, it 
generates my first line without any problem. The only problem I have, is 
that I cant set the names or the ids of the generated textfields. The 
series of generated textfields have ids "textfield" "textfield_0" 
"textfield_1", etc... , and the same goes for the names. Anyway, even if 
I could generate them, I'm not sure it would solve my problem.

When I try to link them to my autocomplete mixin callback, things get 
worse. I tried on a simple case, with a 2 columns grid. I added the 
following method to my component class :
    @OnEvent(value="providecompletions",component="textfield")
    List<String> autoCompleteId(String input) {
        logger.info("Providing completions for textfield") ;
        return new ArrayList<String>() ;
    }
   
    @OnEvent(value="providecompletions",component="textfield_0")
    List<String> autoComplete0(String input) {
        logger.info("Providing completions for textfield_0") ;
        return new ArrayList<String>() ;
    }

But this second method is never called, the "textfield_0" textfield 
calls the first method, not the second one.

Bytheway, I have another problem, that is a T5 textfield wants to be 
included in a form, and it bothers me to put an eclosing form component 
in that grid, bound to be used in other forms itself. So any hint on a 
workaround here would be also appreciated.

I think I'm in a dead end here, and I'm not sure where to go next. So 
any kind of hint would be much appreciated.

José

--------------------
Here is the relevant part my TML for SearchableGrid.tml :

    <table t:id="table">
        <thead t:id="columns"/>

        <tbody>

            <tr>
                <t:form>
                <t:loop source="cellList" value="cell">
                    <t:if test="action">
                        <td>
                            <t:submit t:id="search"/>
                        </td>
                        <t:parameter name="else">
                            <td>
                                <t:textfield t:name="prop:cell" 
t:value="prop:cell" t:mixins="autocomplete"/>
                            </td>
                        </t:parameter>
                    </t:if>
                </t:loop>
                </t:form>
            </tr>

            <tr t:id="rows"/>
       
        </tbody>
    </table>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org