Announcement

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

    Calendar not working?

    I am trying to add a data-bound calendar to my application but something is not working.

    EntryPoint:
    Code:
    public class TestingModule implements EntryPoint {
    
    	@Override
    	public void onModuleLoad() {
    
    		VLayout layout = new VLayout();
    
    		Calendar calendar = new Calendar();
    		calendar.setDataSource(DataSource.get("aufgaben"));
    		calendar.setStartDateField("f_from");
    		calendar.setEndDateField("f_to");
    		calendar.setDescriptionField("f_aufgabe");
    		calendar.setNameField("f_name");
    		calendar.setTitleField("f_name");
    		calendar.setAutoFetchData(true);
    
    		layout.setMembers(calendar);
    		layout.setWidth100();
    		layout.setHeight100();
    
    		layout.draw();
    	}
    
    }
    aufgaben.ds.xml
    Code:
    <DataSource ID="aufgaben" serverType="sql" tableName="t_aufgaben"
    >
    
    	<fields>
    		<field name="f_id" type="sequence" primaryKey="true" />
    		<field name="f_aufgabe" type="ntext" />
    		<field name="f_erledigt" type="boolean" sqlStorageStrategy="number" />
    		<field name="f_name" type="text" />
    
    		<field name="f_from" type="datetime" />
    		<field name="f_to" type="datetime" />
    
    	</fields>
    
    </DataSource>
    I have one entry in my table, which is correctly shown in the calendar. But when I try to create a new entry, (click on space in calendar, click on edit entry), I see the existing entry!!! So instead of creating the new entry, I am editing the existing entry!!!!

    After clicking on "save", the existing entry is edited but the whole application stops working! I have to enter F5 in order to continue. But, when checking the DB, the entry is correctly edited.

    If I edit the existing entry (by moving it for example to another position) , the application stops working again and I have to enter F5 again.

    Maybe the problem has to do with my MSSQL ? Some time ago I had a similar problem and you said the problem was with the MSSQL and then corrected it.

    Using SmartGWT 4.1p Power 10.01.15, MSSQL 2014

    #2
    Can you show the CREATE script for your table?

    Comment


      #3
      Code:
      /****** Object:  Table [dbo].[t_aufgaben]    Script Date: 12.01.2015 09:16:02 ******/
      SET ANSI_NULLS ON
      GO
      
      SET QUOTED_IDENTIFIER ON
      GO
      
      SET ANSI_PADDING ON
      GO
      
      CREATE TABLE [dbo].[t_aufgaben](
      	[f_id] [int] IDENTITY(1,1) NOT NULL,
      	[f_aufgabe] [nvarchar](max) NOT NULL,
      	[f_erledigt] [bit] NOT NULL,
      	[f_from] [datetime] NOT NULL,
      	[f_to] [datetime] NOT NULL,
      	[f_name] [varchar](65) NOT NULL,
       CONSTRAINT [PK_t_aufgaben] PRIMARY KEY CLUSTERED 
      (
      	[f_id] ASC
      )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
      
      GO
      
      SET ANSI_PADDING OFF
      GO

      Comment


        #4
        One of your fields, f_erledigt, is marked as NOT NULL but is not being sent a value. The same applies to your field f_aufgabe, unless you provide a value for it in the UI.

        If you remove the NOT NULL restriction on both of those DB columns and you still see the issue, try changing the type of f_aufgabe to be a normal varchar, rather than an nvarchar(max), and let us know what you find.

        Comment


          #5
          I changed both things and I have the same problems:
          When an entry exists and is visible, I cannot create a new entry (I always end up editing the existing entry wherever I click in the calendar) and when saving the existing entry, the whole application crashes and I have to restart.

          Comment


            #6
            Thanks for the clarification - this is fixed for builds dated January 13 and later.

            Comment


              #7
              Thanks, I will try the new nightly tomorrow.

              Were you able to reproduce both issues? What was the problem?

              Comment


                #8
                We didn't see the crash-on-update issue, but the fix should address both - there was a logic bug in some code that compares whether two calendarEvents are the same.

                Comment


                  #9
                  The first issue is corrected, now I can add new entries and they are saved correctly.

                  But the crash issue is still there: when I try to update one entry, the application crashes.

                  Comment


                    #10
                    Isomorphic, are you able to reproduce the issue ?

                    Comment


                      #11
                      Console logs:
                      Code:
                      16:03:53.631:INFO:Log:initialized
                      16:03:57.081:INFO:Log:isc.Page is loaded
                      16:05:57.192:MUP9:WARN:IButton:isc_ButtonItem_2_button:ignoring bad or negative left: NaN [enable 'sizing' log for stack trace]
                      16:05:57.192:MUP9:WARN:IButton:isc_ButtonItem_2_button:ignoring bad or negative top: NaN [enable 'sizing' log for stack trace]
                      16:06:04.937:XRP5:WARN:Log:TypeError: Cannot read property 'f_id' of null
                      Stack from error.stack:
                      	WeekSchedule.areSame(<no args: exited>) @ ISC_Calendar.js:344:192
                      	Calendar.findEventWindow(<no args: exited>) @ ISC_Calendar.js:219:254
                      	[a]WeekSchedule.renderEvents(<no args: exited>) @ ISC_Calendar.js:103:315
                      	[a]WeekSchedule.retagColumnEvents(<no args: exited>) @ ISC_Calendar.js:100:204
                      	[a]WeekSchedule.retagDayEvents(<no args: exited>) @ ISC_Calendar.js:99:419
                      	Calendar.processSaveResponse(<no args: exited>) @ ISC_Calendar.js:204:103
                      	DataSource.oldValues(<no args: exited>) @ ISC_Calendar.js:200:761
                      	Class._fireCallback(_1=>"isc.Comm.performXmlTransactionReply(1, x..."[54], _2=>"xmlHttpRequest", _3=>Array[1], _4=>[object Window], _5=>true) @ ISC_Core.js:284:49
                      	[a]DataSource.fireCallback(<no args: exited>) @ ISC_Core.js:345:302
                      	DataSource.fireResponseCallbacks(<no args: exited>) @ ISC_DataBinding.js:735:13
                      I sent you the server logs per email because they are too big to post them here.
                      Please let me know if you can reproduce/correct the issue.
                      Last edited by edulid; 15 Jan 2015, 07:14.

                      Comment


                        #12
                        DSRequest:

                        Code:
                        {
                            dataSource:"aufgaben", 
                            operationType:"update", 
                            componentId:"isc_Calendar_0", 
                            data:{
                                f_name:"abc z", 
                                rowID:35, 
                                f_id:61, 
                                f_from:"2015-01-13T08:00:00.000", 
                                f_to:"2015-01-13T13:30:00.000", 
                                f_aufgabe:"this is an example text", 
                                eventLength:19800000, 
                                overlapRangeId:4
                            }, 
                            textMatchStyle:"exact", 
                            willHandleError:true, 
                            showPrompt:true, 
                            oldValues:{
                                f_name:"abc z", 
                                rowID:35, 
                                f_id:61, 
                                f_from:"2015-01-13T08:00:00.000", 
                                f_to:"2015-01-13T13:30:00.000", 
                                f_aufgabe:"", 
                                eventLength:19800000, 
                                overlapRangeId:4
                            }, 
                            requestId:"aufgaben$6271", 
                            fallbackToEval:false, 
                            lastClientEventThreadCode:"MUP3", 
                            bypassCache:true
                        }
                        DSResponse:
                        Code:
                        [
                            {
                                affectedRows:1, 
                                data:[
                                    {
                                        f_name:"abc z", 
                                        f_id:61, 
                                        f_from:new Date(1421136000000), 
                                        f_to:new Date(1421155800000), 
                                        f_aufgabe:"this is an example text"
                                    }
                                ], 
                                invalidateCache:false, 
                                isDSResponse:true, 
                                operationType:"update", 
                                queueStatus:0, 
                                status:0
                            }
                        ]

                        Comment


                          #13
                          We still don't see this - however, we've added some null checks that ought to deal with it based on the logs you posted - you can retest with those changes in tomorrow's build.

                          If you still see issues, your SQL Server could be causing issues - as you know, ntext at least can behave differently on SQL Server.

                          So, start from a datasource that's identical to one of our builtin ones (no ntext or bit fields, eg), and a Calendar that doesn't override any of the field-names - so the Calendar has no field-name settings, and the DB has ones called, for instance "startDate" and "endDate".

                          If that works for you, as it should, re-introduce your DB and DataSource settings until you find the problem and then let us know.

                          Comment


                            #14
                            Thank you, Isomorphic. The 17.01 nightly solved the issue.

                            Comment


                              #15
                              If you add an entry (add dsRequest) , but (because of criteria e.g.) the request returns an empty response, e.g.:
                              Code:
                                  {
                                      affectedRows:1, 
                                      data:[
                                      ], 
                                      invalidateCache:false, 
                                      isDSResponse:true, 
                                      operationType:"add", 
                                      queueStatus:0, 
                                      status:0
                                  }
                              ]
                              then the application crashes again and I get a similar exception as the one you already corrected:

                              Code:
                              11:18:55.980:XRP3:WARN:Log:TypeError: Cannot read property 'f_from' of undefined
                              Stack from error.stack:
                              	Calendar.processSaveResponse(<no args: exited>) @ ISC_Calendar.js:201:11
                              	DataSource.componentId(<no args: exited>) @ ISC_Calendar.js:194:126
                              	Class._fireCallback(_1=>"isc.Comm.performXmlTransactionReply(3, x..."[54], _2=>"xmlHttpRequest", _3=>Array[1], _4=>[object Window], _5=>true) @ ISC_Core.js:283:49
                              	[a]DataSource.fireCallback(<no args: exited>) @ ISC_Core.js:344:302
                              	DataSource.fireResponseCallbacks(<no args: exited>) @ ISC_DataBinding.js:734:13
                              	DataSource.completeResponseProcessing(<no args: exited>) @ ISC_DataBinding.js:731:6
                              	DataSource.handleSCServerReply(<no args: exited>) @ ISC_DataBinding.js:2420:107
                              	Class._fireCallback(_1=>"isc.Comm.performXmlTransactionReply(3, x..."[54], _2=>"xmlHttpRequest", _3=>Array[1], _4=>[object Window], _5=>true) @ ISC_Core.js:283:49
                              	[a]RPCManager.fireCallback(<no args: exited>) @ ISC_Core.js:344:302
                              	RPCManager._fireReplyCallback(<no args: exited>) @ ISC_DataBinding.js:1648:77
                              Could you please also correct this issue? It should be similar as the issue you corrected ,or ?
                              Last edited by edulid; 20 Jan 2015, 03:13.

                              Comment

                              Working...
                              X