While there are many ways to do this specifically I'd use a mixin. I you are
using the Tapesty5-jQuery module there is a generic one for this called
bind. If not then something like this which makes things sortable:


@MixinAfter
public class RowSorter {
                
        @Parameter
        Row row;
        
        @Inject
        JavaScriptSupport javaScriptSupport;
        
        @Inject
        ComponentResources resources;
                
        @Inject
        RowDAO rowDAO;
        

//Does not handle components without ClientElement support      
        @BeginRender
        void beginRender(MarkupWriter writer) {
                String id = null;
                Object compoment =  resources.getContainer();
                if ( ClientElement.class.isAssignableFrom(compoment.getClass()) 
) {
                        id = ((ClientElement)compoment).getClientId();
                }
                
                writer.attributes("sortable","true");
                
                String link = resources.createEventLink("sort").toAbsoluteURI();
                                
                javaScriptSupport.addScript("$(function() { " +
                                "$('#%s').sortable({" +
                                        " update: function(event, ui) { " +
                                        "    var order = 
$(this).sortable('toArray').toString(); " +
                                        "    $.get('%s',{order:order, 
key:'%s'});" +
                                        " }" + 
                                "});" +
                "});",id,link,row.getKey());
                
        }
        
    void onSort(@RequestParameter("order") String sortOrder,
@RequestParameter("key") com.trsvax.entities.Row row) {
        row.setSortOrder(sortOrder);
        rowDAO.save(row);
    }

}

This example uses jQuery to add sortable to a component and call an event
after the sort. You'll need to replace the javascript with something that
handles the textfield event. To use the mixin the tml contains something
like

<t:site.thumbnails thumbnails="thumbnails" t:mixins="rowSorter"
rowSorter.row="row"/>




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/detect-textfield-text-change-tp5477793p5479334.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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

Reply via email to