Announcement

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

    DateItem's DateChooser yields TypeError: _3[i].startDate is undefined error

    It seems that the new FiscalCalendar feature is causing a problem with my DateItems. I can edit a record with the DateItem once, but subsequent attempts to edit any other record (or the same record for that matter) yield the following JS stack trace

    Code:
    10:34:31.752:MUP3:WARN:Log:TypeError: _3[i].startDate is undefined
    Stack from error.stack:
        unnamed(isc_Date__getFiscalYearObjectForDat) @ ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:818
        unnamed(isc_Date_getFiscalYea) @ ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:826
        unnamed(isc_Dat_getFiscalYea) @ ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:858
        unnamed(isc_DateGrid_getWeekRecor) @ ipgui/sc/modules/ISC_Forms.js?isc_version=7.0.js:140
        unnamed(isc_DateGrid_buildCalendarDat) @ ipgui/sc/modules/ISC_Forms.js?isc_version=7.0.js:137
        unnamed(isc_DateGrid_setStartDat) @ ipgui/sc/modules/ISC_Forms.js?isc_version=7.0.js:135
        unnamed(isc_DateChooser_setDat) @ ipgui/sc/modules/ISC_Forms.js?isc_version=7.0.js:164
        unnamed(isc_DateItem_showPicke) @ ipgui/sc/modules/ISC_Forms.js?isc_version=7.0.js:2812
        unnamed() @ ipgui/sc/modules/ISC_Forms.js?isc_version=7.0.js:1175
        unnamed(isc_FormItem__iconClic) @ ipgui/sc/modules/ISC_Forms.js?isc_version=7.0.js:1676
        unnamed(isc_DynamicForm_handleClic) @ ipgui/sc/modules/ISC_Forms.js?isc_version=7.0.js:778
        unnamed(isc_c_EventHandler_bubbleEven) @ ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:1872
        unnamed(isc_c_EventHandler_handleClic) @ ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:1700
        unnamed(isc_c_EventHandler__handleMouseU) @ ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:1686
        unnamed(isc_c_EventHandler_handleMouseU) @ ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:1677
        unnamed(isc_c_EventHandler_dispatc) @ ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:1934
        unnamed(anonymou) @ ipgui/sc/modules/ISC_Core.js?isc_version=7.0.js:63
        unnamed() @
    If I just remove the following from my EntryPoint, the problem goes away.

    Code:
    				DataSource calendarYearDS = DataSource.get(IslandPacificDSConstants.DATASOURCE_CalendarYear);
    				calendarYearDS.fetchData(null, new DSCallback() {
    					@Override
    					public void execute(DSResponse response, Object rawData, DSRequest request) {
    						IPGui.calendarYears = new TreeMap<Date, Integer>();
    						FiscalYear[] fiscalYears = new FiscalYear[response.getData().length];
    						int count = 0;
    						for (Record year : response.getData()) {
    							Date startDate = year.getAttributeAsDate(CalendarYear.START_DATE);
    							IPGui.calendarYears.put(startDate, 
    									year.getAttributeAsInt(CalendarYear.YEAR));
    							FiscalYear fiscalYear = new FiscalYear(
    									year.getAttributeAsInt(CalendarYear.START_YEAR),
    									year.getAttributeAsInt(CalendarYear.START_MONTH)-1,
    									year.getAttributeAsInt(CalendarYear.START_DAY));
    							fiscalYear.setFiscalYear(year.getAttributeAsInt(CalendarYear.YEAR));
    							fiscalYears[count++] = fiscalYear; 
    						}
    						
    						// Set the fiscal calendar so the date picker shows year/week numbers.
    						int lastYear = fiscalYears.length-1;
    						FiscalCalendar fiscalCalendar = new FiscalCalendar(
    								fiscalYears[lastYear].getMonth(), fiscalYears[lastYear].getDate());
    						fiscalCalendar.setFiscalYears(fiscalYears);
    						fiscalCalendar.setDefaultYearMode(FiscalYearMode.END);
    						DateUtil.setFiscalCalendar(fiscalCalendar);
    						DateUtil.setShowChooserFiscalYearPickers(true);
    						DateUtil.setShowChooserWeekPickers(true);
    					}
    				});
    SNAPSHOT_v8.3d_2012-09-05/PowerEdition Deployment (built 2012-09-05)

    Tested with Firefox 14, 15 & IE 9.

    Thoughts?

    #2
    From looking at the internal source, we can see where things are failing but it's not clear how you are getting into this bad state.

    Would you be able to show us a simple test case so we can reproduce the problem?

    Comment


      #3
      Sadly, no. I spent a little time trying to reproduce the issue outside of the application and have not yet been able to do so.

      I'll definitely have to come back to it when I've wrapped up with some other deliverables, but it might go a long way in the meantime if you could elaborate on the "bad state" that's causing the problem?

      Comment


        #4
        Well the "bad state" is basically a case where we've performed some manipulation on the fiscalYears array, including setting the "startDate" property that's reported in the error message on each entry, and then when the method is re run the "startDate" property is no longer present even though it is the same array.

        Our best guess is that the array is being manipulated by application code and our logic is seeing its the same array object and therefore assuming that startDate is present on all entries.

        We've now added a theoretical fix based on this assumption.
        This will show up in the next nightly build.

        If this doesn't resolve it for you, let us know and we'll take another look (though we may need to see a reproducible case for a definite fix!)

        Regards
        Isomorphic Software

        Comment


          #5
          Nice. That did the trick.

          Thanks very much for the hookup.

          Comment

          Working...
          X