PDA

View Full Version : How to change textfield color in DateField



ror
11 Sep 2009, 4:35 AM
Hello,
I am using datefield and I need to change a color(and border) of textfield. I am trying use a style, but it doesen't work. DatePicker is in Layout Container.



DateField data = new DateField();
data.setWidth(150);
data.setFormatValue(true);
data.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd MMMM y"));
data.setValue(new Date());
data.setStylePrimaryName("userDatePickerClear");



and CSS



.userDatePickerClear{
background-color: none !important;
background-image: none !important;
background-color: red !important;
}

In firebug I don't see that datepicker use this style, but when I add style to layout containter its take effects. I am must change color only textfield (datepicker must be untouched).

Arno.Nyhm
14 Sep 2009, 7:18 AM
better use:



data.addStyleName("userDatePickerClear");
and this css


.userDatePickerClear .x-form-text {
background-image: none !important;
background-color: red !important;
}

ror
29 Sep 2009, 12:46 PM
Thanks for answer, I need something like datepicker+label (not edit). I try to write own component but I found another problem (i will create another thread - all problem must by solved :) ). Fastest way to have this functionality is change existing datepicker.
I add some button (+some lines of code). Only what i need now is to
-align text in edit to right
-disable validation checking (I use some special formatting in edit and warning about error is shoving on my additional button).

Arno.Nyhm
30 Sep 2009, 6:01 AM
Thanks for answer,

the idea was to point you not using the GWT setStylePrimaryName but the GXT addStyleName. and not the setStyleName but the addStyleName ... and refine the item you will style.

did my suggestion works?


I need something like datepicker+label (not edit).

ah ok - that was not the question in your first part ;-) maybe you just only hide the editfield with css?

so you need a datepicker but with a hidden textfield? or im wrong.
maybe you have a example picture how it should looks like.




I try to write own component but I found another problem (i will create another thread - all problem must by solved :) ). Fastest way to have this functionality is change existing datepicker.
I add some button (+some lines of code). Only what i need now is to
-align text in edit to right

you can do this with a custom css style.



-disable validation checking (I use some special formatting in edit and warning about error is shoving on my additional button).

you can use a custom renderer to check the formatting or just return true ...