PDA

View Full Version : TwinTriggerField clear trigger rendering bug



sgolla
26 Jun 2009, 4:46 AM
The TwinTriggerField does not render with proper alignment of clear trigger when used inside a flex table (gwt) control. This problem happens only in Internet explorer and only with GXT 2.0 with GWT 1.6 Earlier we were using GXT 1.2 with GWT 1.5, but we did not have this problem. It renders really fine in FF and Chrome browsers.

Here is how it renders awfully in IE 7.0

http://images.upload2world.com/get-6-2009-upload2world_com_kxlvph.jpg

Code which creates my TwinTriggerField object given below:



public static TwinTriggerField GetTwinTriggerField() {
TwinTriggerField ttf = new TwinTriggerField();
ttf.getId(); // call ensures an unique id set.

ttf.setAutoValidate(false);
ttf.setValidateOnBlur(false);

ttf.setHideLabel(true);

ttf.enableEvents(true);
ttf.setWidth(285);

ttf.setTriggerStyle("x-form-search-trigger"); // trigger1.
ttf.setTwinTriggerStyle("x-form-clear-trigger"); // trigger2.

Listener<FieldEvent> clearListener = new Listener<FieldEvent>() {
public void handleEvent(FieldEvent evt) {
TwinTriggerField oSource = (TwinTriggerField) evt
.getComponent();
oSource.setRawValue("");
}
};

ttf.addListener(Events.TwinTriggerClick, clearListener); // trigger2.

return ttf;
}


Below is the code that adds the trigger field created inside a flextable (gwt) control:



FlexTable tbl = new FlexTable();

tbl.setHTML(0, 0, "<div class='logoImage'></div>");
tbl.setHTML(0, 1, "&nbsp;");
tbl.getFlexCellFormatter().setHorizontalAlignment(1, 0,
HasHorizontalAlignment.ALIGN_CENTER);

tbl.setWidget(1, 0, GetTwinTriggerField());
tbl.getFlexCellFormatter().setHorizontalAlignment(0, 0,
HasHorizontalAlignment.ALIGN_CENTER);

Button oAdvButton = new Button("Advanced Search");
tbl.setWidget(1, 1, oAdvButton);

cnt1.add(tbl);