DonX
DonX

Reputation: 16379

DateChooser cannot change to selected date visuallly in smartgwt

I am using DateChooser in my project.In that after selecting some other date the dateChooser remains in same date(in current date).It is not changing visually.I tried with setData() and redraw() method's also.Still it is not working.I am using smartgwt-1.1 and gwt-1.6.4 version.My sample code is :

final DateChooser dateChooser = new DateChooser();
    dateChooser.setWidth("180");
    dateChooser.setHeight("180");

dateChooser.addDataChangedHandler(new DataChangedHandler() {
        public void onDataChanged(DataChangedEvent event) {
                            SC.say(dateChooser.getData()+"");
            dateChooser.setData(dateChooser.getData());
            dateChooser.redraw();
        }
    });

Can anyone give suggestion?

Upvotes: 2

Views: 1721

Answers (2)

Kimi
Kimi

Reputation: 6289

You shouldn't need to set any handlers for DateChooser to make the item work. Did you try it without the DataChangedHandler?

On a side note, you should use addChangedHandler, not addDataChangedHandler when you want an event to fire on user input in a field. DataChangedHandler is fired when a bound datasource's data changes (new data is fetched from the datasource), not when user changes a value on an item.

Upvotes: 1

Matthew Flaschen
Matthew Flaschen

Reputation: 285057

Where are you changing the date from code? I only see dateChooser.setData(dateChooser.getData()), and obviously that code's never going to change the data.

Upvotes: 0

Related Questions