Calendar data via MVC Controller instead of webservice

  1. #1

    Calendar data via MVC Controller instead of webservice

    Is this possible? I get a communication error from EXT after the controller returns.
    Does it only work via webservice?
    Thanks,
    /Z
    aspx file:
                            <ext:CalendarPanel
                                ID="CalendarPanel1" 
                                runat="server"
                                Region="Center"
                                ActiveIndex="2"
                                Border="false">
                                <GroupStore ID="GroupStore1" runat="server">
                                    <Groups>
                                        <ext:Group CalendarId="1" Title="Home" />
                                        <ext:Group CalendarId="2" Title="Work" />
                                        <ext:Group CalendarId="3" Title="School" />
                                    </Groups>
                                </GroupStore>
                                <EventStore 
                                    ID="EventStore1" 
                                    runat="server" 
                                    DateFormat="M$"
                                    SaveMappings="false">
                                    <Proxy>
                                        <ext:HttpProxy Url="/Sch/GetSch" Json="true" />
                                    </Proxy>
                                    <Reader>
                                        <ext:JsonReader Root="data" />
                                    </Reader>
                                </EventStore>
                                <MonthView ID="MonthView1" 
                                    runat="server" 
                                    ShowHeader="true" 
                                    ShowWeekLinks="true" 
                                    ShowWeekNumbers="true" 
                                    />  
                                <Listeners>
                                    <ViewChange  Fn="CompanyX.viewChange" Scope="CompanyX" />
                                    <EventClick  Fn="CompanyX.record.show" Scope="CompanyX" />
                                    <DayClick    Fn="CompanyX.dayClick" Scope="CompanyX" />
                                    <RangeSelect Fn="CompanyX.rangeSelect" Scope="CompanyX" />
                                    <EventMove   Fn="CompanyX.record.move" Scope="CompanyX" />
                                    <EventResize Fn="CompanyX.record.resize" Scope="CompanyX" />
                                    <EventDelete Fn="CompanyX.record.remove" />
                                </Listeners>                          
                            </ext:CalendarPanel>
    Controller:
            public AjaxResult GetSch()
            {
                var now = DateTime.Now.Date;
                List<Event> col = new List<Event>(){ 
                        new Event
                        {
                            EventId = 1001,
                            CalendarId = 1,
                            Title = "Vacation",
                            StartDate = now.AddDays(-20).AddHours(10),
                            EndDate = now.AddDays(-10).AddHours(15),
                            IsAllDay = false,
                            Notes = "Have fun"
                        }
                    };
                var query = from dt in
                                (col
                              )
                            select new
                            {
                                EventId = dt.EventId,
                                CalendarId = dt.CalendarId,
                                Title = dt.Title,
                                StartDate = dt.StartDate,
                                EndDate = dt.EndDate,
                                IsAllDay = dt.IsAllDay,
                                Notes = dt.Notes
                            };
                return new AjaxResult(query);
            }
  2. #2
    Hi,

    I think you should remove Json="true".
  3. #3

    Calendar via MVC instead of webservice

    Danill,

    that fixed the communication error.

    However, now i get a popup "Request Error" status code 200.

    the popup box has this in it:
    {result:[{"EventId":1001,"CalendarId":1,"Title":"Vacation","StartDate":"2012-01-19T10:00:00.000","EndDate":"2012-01-29T15:00:00.000","IsAllDay":false,"Notes":"Have fun"}]}
    Thoughts?
    /Z


    Quote Originally Posted by Daniil View Post
    Hi,

    I think you should remove Json="true".
    Last edited by Daniil; Feb 08, 2012 at 7:12 AM. Reason: Please use [CODE] tags
  4. #4
    Please try to set up the following Reader for the EventStore.
    <EventStore runat="server">
        <Reader>
            <ext:JsonReader Root="result" IDProperty="EventId" />
        </Reader>
    </EventStore>
  5. #5

    Calendar via MVC instead of webservice

    Thanks!

    I ended up changing it to this (below). I was also required to remove the DateFormat="M$" otherwise, the evt object never passed back the StartDate and EndDate.

    Works great!
    /Z


                                    <Reader>
                                        <ext:JsonReader Root="result" IDProperty="EventId" >
                                            <Fields>
                                                <ext:RecordField Name="EventId" Type="Int"/>
                                                <ext:RecordField Name="CalendarId" Type="Int"/>
                                                <ext:RecordField Name="Title" Type="String" />
                                                <ext:RecordField Name="StartDate" Type="Date" />
                                                <ext:RecordField Name="EndDate" Type="Date" />
                                                <ext:RecordField Name="IsAllDay" Type="Boolean" />
                                                <ext:RecordField Name="Notes" Type="String" />
                                            </Fields>
                                        </ext:JsonReader>
                                    </Reader>

    Quote Originally Posted by Daniil View Post
    Please try to set up the following Reader for the EventStore.
    <EventStore runat="server">
        <Reader>
            <ext:JsonReader Root="result" IDProperty="EventId" />
        </Reader>
    </EventStore>
  6. #6

    EventSotre updateproxy not working

    Hello,

    I'm working on Calendar control and had an issues related to EventStore.
    My code shows like below:
    <ext:EventStore
        ID="dsEvents"
        runat="server"
        AutoLoad="true" Namespace="CompanyX">
        <Proxy>
            <ext:HttpProxy Url="/Home/GetEvent/" />
        </Proxy>
        <UpdateProxy>
            <ext:HttpWriteProxy Url="/Home/SaveEvent/" />
        </UpdateProxy>
        <Reader>
            <ext:JsonReader IDProperty="EventId" Root="data">
                <Fields>
                    <ext:RecordField Name="EventId"/>
                    <ext:RecordField Name="GroupId" />
                    <ext:RecordField Name="CalendarId" />
                    <ext:RecordField Name="Title" />
                    <ext:RecordField Name="StartDate" />
                    <ext:RecordField Name="EndDate" />
                    <ext:RecordField Name="Location" />
                    <ext:RecordField Name="IsAllDay" />
                    <ext:RecordField Name="Notes" />
                    <ext:RecordField Name="Reminder" />
                    <ext:RecordField Name="Url" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <Listeners>
            <CommitDone Handler="#{dsEvents}.reload();" />
        </Listeners>
    </ext:EventStore>
    My problem is update proxy not worked, I've check in javascript and see that update proxy url is undefined.
    Can you guy help me?

    Many thanks?
  7. #7
    Hi @,

    I was unable to reproduce the problem using the example below.

    I see
    updateProxy : new Ext.net.HttpWriteProxy({
        url : "Some URL to update"
    })
    in the Page Sources.

    Example
    <%@ Page Language="C#" %>
    
    <%@ 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>Ext.NET Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Viewport runat="server" Layout="FitLayout">
            <Items>
                <ext:CalendarPanel runat="server">
                    <EventStore runat="server">
                        <UpdateProxy>
                            <ext:HttpWriteProxy Url="Some URL to update" />
                        </UpdateProxy>
                    </EventStore>
                </ext:CalendarPanel>
            </Items>
        </ext:Viewport>
    </body>
    </html>
    Please provide your test case.

Similar Threads

  1. Replies: 1
    Last Post: Jul 02, 2012, 6:19 PM
  2. Replies: 7
    Last Post: May 15, 2012, 11:27 AM
  3. [CLOSED] passing data from controller to 'RemoteActionSuccess'
    By jesperhp in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 16, 2011, 6:48 PM
  4. Replies: 5
    Last Post: Jun 13, 2011, 8:48 AM
  5. [CLOSED] [1.0] Load Data by WebService VS GenericHandler
    By webclouder in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: May 31, 2010, 11:13 AM

Tags for this Thread

Posting Permissions