1. #1
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    361
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Question GXT DateTimeField?

    GXT DateTimeField?


    In our apps we often have to set specific dates and times (i.e. a date without a time is to vague). Does GXT have a component that sets both? I see the DateField and TimeField but didn't see a way to combine them, is this possible? I'd be okay with the DateField with spinners at the bottom to set hours:minuteseconds, etc.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Nov 2010
    Posts
    209
    Vote Rating
    -2
    Ersmarker has a little shameless behaviour in the past

      0  

    Default


    You can build it using a MultiField

    The example below is not tested but should give you a good startingpoint.

    Code:
        public class DateTimeField extends MultiField<Date> {
    
    
            private final TimeField timeField;
            private final DateField dateField;
    
    
            public DateTimeField() {
                super();    
                dateField = new DateField();
                add(dateField);
                timeField = new TimeField();
                add(timeField);
            }
            
            @Override
            public Date getValue() {
                Date result = dateField.getValue();
                if (result == null) {
                    return null;
                }
                return new Date(result.getTime() + timeField.getValue().getDate().getTime());
            }
    
    
            @Override
            public void setValue(Date value) {
                dateField.setValue(new Date(value.getYear(), value.getMonth(), value.getDate()));
                timeField.setValue(new Time(value.getHours(), value.getMinutes()));
            }
        }

  3. #3
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    361
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Default


    I'm not finding the MultiField<> type in 3.x is there something equivalent?

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,639
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    I've built such a thing subclassing Field (or AdapterField) in 2.x. As mentioned, MultiField could also work in 2.

    In 3, I'd probably start by making an Editor instance with two sub-editors, one DateField and one TimeField, each using @Path("") to have them bind to the same value.

    Or make the new class implement IsField, and use setValue() and getValue() to modify/read both sub-editors.

    IsField is what is being used in 3 to replace most MultiField cases - it allows a widget to supply methods that are helpful for most fields, and as it extends LeafValueEditor, it can be used in GWT Editor framework, and subfields will be ignored, leaving the dev to write their own logic for binding the values.

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar