Apr 18, 2012, 7:27 PM
[CLOSED] ext:Calendar EventStore appears call the webservice 3 or more times when page is loaded.
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
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>
WebServiceImports 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
Last edited by Daniil; May 09, 2012 at 10:22 PM.
Reason: [CLOSED]