-
@bbg: Well, being new to GWT development, I haven't used much Cells yet. If you have a sample code to share (how to add it to a Sencha text field), I would be glad.
Beside, I stands by my point: it makes, if not really "hard", non obvious to have this very common functionality.
-
Well I ended up overriding ComboBoxCell and TextInputCell to do the following:
ComboBoxCell instead of String, you'll want to type cast with T.
Code:
@Override
protected void onEnterKeyDown(Context context, Element parent, String value,
NativeEvent event, ValueUpdater<String> valueUpdater) {
super.onEnterKeyDown(context, parent, value, event, valueUpdater);
fireEvent(new EnterKeyDownEvent());
}
Where, EnterKeyDownEvent looks like so:
Code:
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.EventHandler;
public class EnterKeyDownEvent extends GwtEvent<EnterKeyDownEventHandler> {
public static Type<EnterKeyDownEventHandler> TYPE = new Type<EnterKeyDownEventHandler>();
public EnterKeyDownEvent() {}
@Override
protected void dispatch(EnterKeyDownEventHandler handler) {
handler.enterDown(this);
}
@Override
public Type<EnterKeyDownEventHandler> getAssociatedType() {
return TYPE;
}
public interface EnterKeyDownEventHandler extends EventHandler {
void enterDown(EnterKeyDownEvent event);
}
}
Then just add a handler on the cell for the enterKeyDownEvent.
-
Just a thought, it would be nice if someone added this functionality into the core AbstractEventInputCell, then you wouldn't have to override for every cell type class.
-
@mtraynham: many thanks, it works well!
Indeed, it would be nice to have that in the core. I had to make a TextInputCell and a PasswordinputCell overriding onEnterKeyDown as you shown, to create the handler with the login action, to attach the handler to the cells and to create the input fields with the cells as parameters. A bit convoluted... But it works!
-
Please let me know if it is added to the core?
-
Hi,
I have the same bug in the final version !
Will you correct it or not ?
Thanks.
-
+1
Waiting for a fix. Even if the workaround is easy :)