Announcement

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

    Calendar.getData() is not yet implemented, how to get all calendar records ?

    How to get all calendar records ?
    I think, is the Calendar.getData() method is to do, but she is comment.

    Based on ListGrid.getRecords(), i have implement Calendar.getData() :
    Code:
        public CalendarEvent[] getData() {	
            JavaScriptObject dataJS = getAttributeAsJavaScriptObject("data");
            CalendarEvent[] data = convertToCalendarEventArray(dataJS);
            return data;
        }
    
        private static CalendarEvent[] convertToCalendarEventArray(JavaScriptObject nativeArray) {
            if (nativeArray == null) {
                return new CalendarEvent[]{};
            }
            JavaScriptObject[] componentsj = JSOHelper.toArray(nativeArray);
            CalendarEvent[] objects = new CalendarEvent[componentsj.length];
            for (int i = 0; i < componentsj.length; i++) {
                JavaScriptObject componentJS = componentsj[i];
                CalendarEvent obj = (CalendarEvent) RefDataClass.getRef(componentJS);
                if (obj == null) obj = new CalendarEvent(componentJS);
                objects[i] = obj;
            }
            return objects;
        }
    sjivan, if you can add it to SVN ? thanks. I have succefuly tested this mmethod.
Working...
X