Search code examples
gwtgxt

Sencha GXT 2.x Spinner Field


I am having a couple of problems with my SpinnerField in GXT 2.0. First it is showing doubles when the user changes 1.0,2.0 I need it to show Ints 1,2,3 etc.

Second, for the life of me I cannot figure out how to add a change listener to it. Like user makes a change it pops up an alert with the value: just for demonstration purposes.

I have looked through the documentation but cannot find the answer.


Solution

  • try adding this to spinner field :

    spinner.setFormat(NumberFormat.getFormat("0"));
    spinner.addListener(Events.KeyPress, new KeyListener() {...});
    spinner.addListener(Events.Change, new Listener<BaseEvent>(){...});