PDA

View Full Version : [CLOSED] ext:Calendar EventStore appears call the webservice 3 or more times when page is loaded.



supera
Apr 18, 2012, 7:27 PM
Hi

I have a ext:CalendarPanel in aspx page. EventStore is bind with a webservice.

When page is loaded (I think this process occurs in page_init, because some ext controls are not created in this step), my Webservice is called 3 times...

I think its occurs because the 3 views of my CalendarPanel.
I made a sample...
Pay attention to the dates that appear in msgbox inside the webservice.

Main Page



<%@ Page Language="vb" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

<script type="text/javascript">

var CompanyX = {
getCalendar: function () {
return CompanyX.CalendarPanel1;
},
getWindow: function () {
return CompanyX.EventWindow1;
},
dayClick: function (cal, dt, allDay, el) {
this.record.show.call(this, cal, {
StartDate: dt,
IsAllDay: allDay
}, el);
},
record: {
show: function (cal, rec, el) {
CompanyX.getWindow().show(rec, el);
},
edit: function (win, rec) {
win.hide();
rec.commit();
CompanyX.getCalendar().showEditForm(rec);
}
}
};
</script>

</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" Namespace="CompanyX"/>
<form id="form1" runat="server">
<ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
<Items>
<ext:CalendarPanel ID="CalendarPanel1" runat="server"
ActiveIndex="1">
<EventStore ID="EventStore1" runat="server" NoMappings="true">
<Proxy>
<ext:AjaxProxy Url="/Events.asmx/GetEvents" Json="true">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader Root="d" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Mappings>
<ext:ModelField Name="StartDate" Type="Date" DateFormat="M$" />
<ext:ModelField Name="EndDate" Type="Date" DateFormat="M$" />
</Mappings>
</EventStore>
<CalendarStore ID="CalendarStore1" runat="server">
<Calendars>
<ext:CalendarModel CalendarId="1" Title="Importante" ColorId="1" />
<ext:CalendarModel CalendarId="2" Title="Comercial" ColorId="2"/>
<ext:CalendarModel CalendarId="3" Title="Pessoal" ColorId="3"/>
</Calendars>
</CalendarStore>
<Listeners>
<DayClick Fn="CompanyX.dayClick" Scope="CompanyX" />
<EventClick Fn="CompanyX.record.show" Scope="CompanyX" />
</Listeners>
</ext:CalendarPanel>
</Items>
</ext:Viewport>
<ext:EventWindow
ID="EventWindow1"
runat="server"
Hidden="true"
TitleTextAdd="Adicionar Novo."
TitleTextEdit="Editar evento"
CalendarStoreID="CalendarStore1">
<Listeners>
<EditDetails Fn="CompanyX.record.edit" Scope="CompanyX" />
</Listeners>
</ext:EventWindow>
</form>
</body>
</html>


WebService


Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.Web.Script.Services

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:= WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Events
Inherits System.Web.Services.WebService

<WebMethod()> _
<ScriptMethod()> _
Public Function GetEvents([start] As Date, [end] As Date) As Ext.Net.EventModelCollection
Dim evt As Ext.Net.EventModel
Dim vret As New Ext.Net.EventModelCollection

evt = New Ext.Net.EventModel
evt.CalendarId = 1
evt.StartDate = CDate(DateValue(Now) & " 08:00")
evt.EndDate = CDate(DateValue(Now) & " 09:00")
evt.Title = "test 1"
evt.Notes = "test"
evt.Location = "supera"

vret.Add(evt)

evt = New Ext.Net.EventModel
evt.CalendarId = 2
evt.StartDate = Now
evt.EndDate = DateAdd(DateInterval.Day, 1, Now)
evt.Title = "test 2"
evt.Notes = "test 2"
evt.Location = "supera"

vret.Add(evt)

MsgBox("Calling WebService" & vbCrLf & "start: " & [start] & vbCrLf & "end: " & [end], vbExclamation)

Return vret

End Function

End Class

Daniil
Apr 19, 2012, 3:29 PM
Hi,

Yes, it's a known problem. We will work on it. Hope to fix on next week.

supera
Apr 19, 2012, 4:17 PM
Hi Daniil!

No problem... I'll be waiting then.

Thanks for your help.

Daniil
May 09, 2012, 11:10 AM
The issue has been fixed in SVN, please update and re-test.

Thanks again for the report.

supera
May 14, 2012, 12:58 PM
Hi Daniil!

I having a little problem with this!

My web service is called one time now... itīs right.

But the 'start' and 'end' arguments of my web service are getting with same date and my default viewmode is 'week' (ActiveIndex="1").

I think that the 'start' and 'end' arguments should receive the start date and end date of week.

As it is working, when my application is started, the calendarPanel is loaded only with the data of current day.

Daniil
May 14, 2012, 1:42 PM
Thanks for the report. We will check.

Vladimir
May 14, 2012, 10:01 PM
Fixed in SVN. Please update and retest

supera
May 15, 2012, 11:27 AM
Hi Vladimir!

Works fine now!

Thanks a lot.