如果为假,也将所有事件显示为完整日历中的全天



我对全天事件有问题,在完整的日历中,如果我将 allday 设置为 false,那么它仍然显示为全天,有人能明白为什么吗!?我已经添加了全天,所以我不知道它是否是我使用的正确名称,但日历工作正常,它只是将所有事件显示为 AllDays。

<%@ WebHandler Language="VB" Class="fullcalendarjson" %>
Imports System
Imports System.Collections.Generic
Imports System.Web
Imports System.IO
Public Class fullcalendarjson : Implements IHttpHandler
Public Sub ProcessRequest(context As HttpContext) Implements IHttpHandler.ProcessRequest
    context.Response.ContentType = "text/plain"
    context.Response.Expires = -1
    Dim tasksList As IList(Of CalendarDTO) = New List(Of CalendarDTO)()
    tasksList.Add(New CalendarDTO() With { _
        .id = 1, _
        .title = "Google search", _
        .start = ToUnixTimespan(DateTime.Now), _
        .[end] = ToUnixTimespan(DateTime.Now.AddHours(4)), _
        .url = "www.google.com", _
        .allday = False _
    })
    tasksList.Add(New CalendarDTO() With { _
        .id = 1, _
        .title = "Bing search", _
        .start = ToUnixTimespan(DateTime.Now.AddDays(1)), _
        .[end] = ToUnixTimespan(DateTime.Now.AddDays(1).AddHours(4)), _
        .url = "www.bing.com", _
        .allday = False _
    })
    tasksList.Add(New CalendarDTO() With { _
        .id = 1, _
        .title = "AllDay search", _
        .start = ToUnixTimespan(DateTime.Now.AddDays(3)), _
        .[end] = ToUnixTimespan(DateTime.Now.AddDays(3)), _
        .url = "www.bing.com", _
        .allday = True _
    })
    Dim oSerializer As New System.Web.Script.Serialization.JavaScriptSerializer()
    Dim sJSON As String = oSerializer.Serialize(tasksList)
    context.Response.Write(sJSON)
End Sub
Private Function ToUnixTimespan([date] As DateTime) As Long
    Dim tspan As TimeSpan = [date].ToUniversalTime().Subtract(New DateTime(1970, 1, 1, 0, 0, 0))
    Return CLng(Math.Truncate(tspan.TotalSeconds))
End Function
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
    Get
        Return False
    End Get
End Property
Public Class CalendarDTO
    Public Property id() As Integer
        Get
            Return m_id
        End Get
        Set(value As Integer)
            m_id = Value
        End Set
    End Property
    Private m_id As Integer
    Public Property title() As String
        Get
            Return m_title
        End Get
        Set(value As String)
            m_title = Value
        End Set
    End Property
    Private m_title As String
    Public Property start() As Long
        Get
            Return m_start
        End Get
        Set(value As Long)
            m_start = Value
        End Set
    End Property
    Private m_start As Long
    Public Property [end]() As Long
        Get
            Return m_end
        End Get
        Set(value As Long)
            m_end = Value
        End Set
    End Property
    Private m_end As Long
    Public Property url() As String
        Get
            Return m_url
        End Get
        Set(value As String)
            m_url = Value
        End Set
    End Property
    Private m_url As String
    Public Property allday() As String
        Get
            Return m_allday
        End Get
        Set(value As String)
            m_allday = value
        End Set
    End Property
    Private m_allday As String
End Class
End Class

allday 应该是 allDay - d 是大写字母。默认情况下,allDay 为 true - 但可以使用 allDayDefault 选项 - http://arshaw.com/fullcalendar/docs/event_data/allDayDefault/来控制此默认行为

相关内容

  • 没有找到相关文章

最新更新