Announcement

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

    How to set the value of ListGridFieldType.Time (bug or API missing?)

    I'm a little stumped on how I am supposed to set the value of a ListGridField that is of type time.

    If I call setAttribute("someTime",Date()) it formats it ok on view, but then applies a Timezone change to my date when the editor starts.

    If I call setAttribute("someTime", JavascriptObject()) - where the JSO is a time (""08:00:00"") then it works correctly.

    Is this a bug or a limitation of the API? Or are there methods to programmaticly set a time?

    #2
    Btw, as a suggestion, it would be great if SmartGWT defined a Time.java class - this would make a lot of this confusion go away. Abusing the poorly supported Date class can be pretty confusing (eg. where times are represented in Local time, while Dates are represented in UTC, and so on)

    Comment


      #3
      This workaround consists of formatting a date string eg, "14:00:00" and then calling the SmartClient Time method. Does the job. But leaves me scratching my head why this was not easy.

      Code:
      	public static native JavaScriptObject timeStringToDateJSO(String timeString) /*-{
      		var ret = $wnd.isc.Time.parseInput(timeString);
      		return ret;
      	}-*/;

      Comment


        #4
        *sigh* ... there is an easier way.

        Code:
         record.setAttribute("someTime","14:00:00")

        Comment

        Working...
        X