Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DateItem browsers problem - if manually changed and focus on it - did not save

    Hi,

    I'm using com.smartgwt.client.widgets.form.fields.DateItem widget.

    Code:
    DateItem date = new DateItem("A date");
    date.setWidth(320);
    date.setWrapTitle(false);
    date.setAttribute("useTextField", true); 
    date.setAttribute("inputFormat", "yyyy/MM/dd");
    date.setAttribute("displayFormat", "toJapanShortDate");

    I'm adding this date on a DynamicForm:

    Code:
    DynamicForm  form = new DynamicForm();
    form.setFields(date);
    and this form on a VLayout object:

    Code:
    VLayout editLayout = new VLayout(30);
    editLayout.addMember(form);
    The problem is reproducing in browsers like Firefox & Chrome when:

    1. I'm selecting first the date from calendar - say I'm selecting 2011/02/11
    2. I'm changing the day in 2011/02/12 manually - and I'm not changing the focus from this date field
    3. I'm p the 'Save' button.

    After these steps the date is 2011/02/11 and not 2011/02/12 how it should be.
    In Internet Explorer browser did not happen - the date after the steps above is 2011/02/12!

    I'm using smartgwt 2.4.

    Thank you.

    -----------------------------
    Later edit:

    I'm using a DataSource for updating the data.

    I'm having a UserObject and in the userUpdate method I'm creating this user object first with values from fields (which are on the DynamicForm) - by calling the generateUserObjectFromForm() method

    Code:
    UserObject   user = generateUserObjectFromForm();
    Here, in this method I'm doing something like: user.setAddedDate(date.getValueAsDate()), but here the date.getValueAsDate() value is the one selected from calendar, not the one modified manually.

    I'm using an request object (UserUpdateRequest) for updating the user.

    UserUpdateRequest looks like:

    Code:
    public class UserUpdateRequest implements IsSerializable
    {
        UserObject user = null;
    
        public UserUpdateRequest ()
        {
        }
    
        public UserUpdateRequest (UserObject user)
        {
            this.user = user;
        }
    
        public UserObject getUser ()
        {
            return user;
        }
    }
    
    final UserUpdateRequest request = new UserUpdateRequest(user);
    and on the RPC user update method I'm sending this UserUpdateRequest request.
    Last edited by manu_tmu; 20 Feb 2011, 22:59.

    #2
    I near resolved this isuue in this way:

    Code:
    setTitle("Date");
            setWrapTitle(false);                            // Do not wrap the title
            setTitleOrientation(TitleOrientation.LEFT);        // Title on the left
            setTitleAlign(Alignment.LEFT);
            setAttribute("useTextField", true);
            setAttribute("displayFormat", "toJapanShortDate");
    
            TextItem textDateItem = new TextItem();
            textDateItem.setAttribute("readOnly", true);
            setAttribute("textFieldProperties", textDateItem);
    so now I can not edit manually the date, even is not quite the result I wanted to be....

    Still need opinions...
    Last edited by manu_tmu; 20 Feb 2011, 23:00.

    Comment

    Working...
    X