View Full Version : DatePicker,can we get the instance of the Button in it?

Love Yao
13 Jan 2010, 12:28 AM
after reading the Source of the datePicker ,
i using the method
Element[] cel = Util.toElementArray(el().select(".x-date-left-icon"));

so I can get the Element of the (IconButton prevBtn) = cel[0]
then i want to Rewrite the "prevbtn.addselectionListener<IconButtonEvent>"

I think maybe it is a question about GWT knowledge, can we using the "Element" to get the instance of the prevBtn and how?


15 Jan 2010, 8:07 AM
maybe it is better if you try to access it with a native JSNI.

Extend you datepicker and then access the buttons like this (code not tested - just as a try):

public class ExtendedDatePicker extends DatePickera> {

private native IconButton getPrevButton()
return this.@com.extjs.gxt.ui.client.widget.DatePicker::prevBtn;

private native IconButton getNextButton()
return this.@com.extjs.gxt.ui.client.widget.DatePicker::nextBtn;

Love Yao
21 Jan 2010, 10:01 PM
great !! it works