[CLOSED] [1.0] CalendarPanel

  1. #1

    [CLOSED] [1.0] CalendarPanel

    Hello,

    Having trouble using the calendar for the first time, can someone give me a push? Here is what I have in the markup:

                                <ext:CalendarPanel ID="Calendar" runat="server"
                                    Border="false">
                                    <EventStore runat="server">
                                        <Proxy>
                                            <ext:HttpProxy AutoDataBind="true" Method="POST" Url='<%# Url.Action("Get", "Event") %>' />
                                        </Proxy>
                                        <Reader>
                                            <ext:JsonReader Root="data" />
                                        </Reader>
                                    </EventStore>
                                </ext:CalendarPanel>
    Here what my JSON is returning for /Event/Get
    {data:[{"EventId":"72b9975b-500d-42c9-bf8f-d68831778aef","Title":"Title","StartDate":"2011-04-01T00:00:00","EndDate":"2011-04-01T09:00:00"}],total:1,success:true}
    The events are not being rendered on the calendar, any suggestions? Would really appreciate a push in the right direction, wasted a couple hours with this already :)

    Cheers,
    Timothy
    Last edited by Daniil; Apr 15, 2011 at 11:46 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please set DateFormat="M$" for event store, like in the following sample
    https://examples1.ext.net/#/Calendar...w/Remote_Data/
  3. #3
    Quote Originally Posted by Vladimir View Post
    Hi,

    Please set DateFormat="M$" for event store, like in the following sample
    https://examples1.ext.net/#/Calendar...w/Remote_Data/
    Thanks vladsch, that actually didn't do anything when I refreshed. However I did note that if I put a "CalendarId" in the JSON response, then my event showed up. Can you explain why I would need that property?

    Cheers
  4. #4
    "CalendarId" provides css rules applied to an event. So, it's required.
  5. #5
    Quote Originally Posted by Daniil View Post
    "CalendarId" provides css rules applied to an event. So, it's required.
    Thanks Daniil, one last question. Why does EventId have to be an int? I'm trying to bind a GUID to the EventId and when I do a record.data.EventId it returns the first couple digits of my GUID but not the entire GUID?

    Cheers
  6. #6
    Well, I didn't know that eventId must be int and reviewed the calendar's sources.

    I found
    EventId: {
        name: 'EventId',
        mapping: 'id',
        type: 'int'
    }
    in EventRecord.js.

    So, it's really must be int, but I'm not sure why it is.

    I reviewed all eventId appearances and can't see any operations where eventId must be int.

    I see that for new added records
    newId: 10000
    
    this.newId++
    is used. But still don't understand why eventId must be int.

    I bet that Vladimir knows:)
  7. #7
    Quote Originally Posted by Daniil View Post
    I bet that Vladimir knows:)
    I have discussed this with Vladimir. His answer was "It's so, because it's so". Well, this question is for calendar's creators - ext.ensible.com.

    But we can suggest you to add your own field into EventStore and use it as you wish.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        class MyEvent : Event
        {
            public Guid Guid { get; set; }
        }
    
        protected void Page_Load(object sender, EventArgs e)
        {
            this.CalendarPanel1.EventStore.AddStandardFields();
            this.CalendarPanel1.EventStore.Reader[0].Fields.Add(new RecordField("Guid"));
    
            if (!X.IsAjaxRequest)
            {
                Store store = this.CalendarPanel1.EventStore;
                store.DataSource = new List<object>
                {
                    new MyEvent()
                    {
                        Title = "My event",
                        CalendarId = 1,
                        StartDate =  DateTime.Now,
                        EndDate =  DateTime.Now.AddDays(1),
                        Guid = Guid.NewGuid()
                    }
                };
                store.DataBind();
            }
        }
    </script>
    
    <!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>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Viewport runat="server" Layout="fit">
            <Items>
                <ext:CalendarPanel ID="CalendarPanel1" runat="server" ButtonAlign="Center">
                    <EventStore runat="server" />
                    <Buttons>
                        <ext:Button runat="server" Text="Get Guid">
                            <Listeners>
                                <Click Handler="alert(CalendarPanel1.eventStore.getAt(0).get('Guid'));" />
                            </Listeners>
                        </ext:Button>
                    </Buttons>
                </ext:CalendarPanel>
            </Items>
        </ext:Viewport>
        </form>
    </body>
    </html>
  8. #8
    Thanks Daniil, I'll use my own attribute.

    Vladsch, thanks for nothing :)

    Cheers

Similar Threads

  1. [CLOSED] Calendarpanel + objectgadatsource
    By bossun in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 08, 2012, 1:40 PM
  2. [CLOSED] CalendarPanel filters
    By marco.morreale in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 05, 2012, 1:32 PM
  3. [CLOSED] CalendarPanel Issues
    By cleve in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 05, 2012, 5:24 AM
  4. [CLOSED] CalendarPanel - First day of the week
    By marco.morreale in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: May 11, 2012, 5:51 PM
  5. [CLOSED] [1.0] CalendarPanel Question
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 22, 2011, 3:43 PM

Tags for this Thread

Posting Permissions