This is a migrated thread and some comments may be shown as answers.

More info in day event

6 Answers 51 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 1
Edward asked on 22 Aug 2014, 08:34 PM
How do I get more information in the displayed event?  Currently it only displays the title (see attached image).  I looked at this: http://demos.telerik.com/aspnet-mvc/scheduler/templates (this is the example that has an IMDB link on it using the following code.) but it can't be doubled clicked to edit the event.

.EventTemplate(
    "<div class='movie-template'>" +
        "<img src='" + Url.Content("~/Content/web/scheduler/") + "#= Image #' />" +
        "<p>" +
            "#= kendo.toString(start, 'hh:mm') # - #= kendo.toString(end, 'hh:mm') #" +
        "</p>" +
        "<h3>#= title #</h3>" +
        "<a href='#= Imdb #'>Movie in IMDB</a>" +
    "</div>")

I'd like to do something like this but be able to double click it and change it.

6 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 25 Aug 2014, 01:57 PM
Hello Matt,

The editing of the aforementioned demo is disabled and that is why editor template is not shown on double click. You can use the event template to define the content of the rendered event and still have an editable scheduler.

Regards,
Georgi Krustev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Edward
Top achievements
Rank 1
answered on 28 Aug 2014, 02:25 PM
I clicked the three links you had in your reply and they all go to the same url, Scheduler demo.  I do not see where that url is helping.  Can you elaborate which scheduler demo I need to look at?
0
Georgi Krustev
Telerik team
answered on 28 Aug 2014, 04:05 PM
Hello Matt,

Something goes wrong while I was specifying the links. Please excuse me for that. Here is the correct text of the message:

The editing of the aforementioned demo (check the editable: false option) is disabled and that is why editor template is not shown on double click. You can use the event template to define the content of the rendered event and still have an editable scheduler. For instance, here is a demo with event templates and enabled editing.

Regards,
Georgi Krustev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Edward
Top achievements
Rank 1
answered on 03 Sep 2014, 09:01 PM
The problem is when I create a new task the AssetName and OwnerName is NULL.  I have two resources that set assetid and userid.  I need the text value from the dropdowns to be AssetName and OwnerName.


After thinking about it makes since that they are NULL on creation b/c the only thing that populates them is my read method to my
db.  Once I refresh the page both the AssetName and OwnerName contain the right data. 

I need to know either how to query the db to get this information upon task dialog closing or somehow bind the AssetName to the DataTextField on the resource for m => m.AssetID and bind the OwnerName to the DataTextField on the resource for m => m.OwnerID.

 
@(Html.Kendo().Scheduler<GIS.Services.Pulse.Types.Models.TaskAsset>()
    .Name("scheduler")
    .Date(Model.Date)
    .StartTime(Model.Date)
    .Height(800)
    .EventTemplate(
            "<div class='asset-task'>" +
                "<strong>#= title #</strong>" +
                "<p>" +
                    "<strong>Asset: </strong>#= AssetName #" +
                    "<br>" +
                    "<strong>Owner: </strong>#= OwnerName #" +
                "</p>" +
            "</div>"
    )
    .Views(views =>
    {
        views.DayView();
        views.WorkWeekView();
        views.WeekView();
        views.MonthView(monthView => monthView.Selected(true)).EventHeight(70);
        views.AgendaView();
    })
    .Timezone("Etc/UTC")
    .Resources(resource =>
    {
        resource.Add(m => m.AssetID)
            .Title("Asset")
            .DataTextField("Name")
            .DataValueField("AssetID")
            .DataSource(ds => ds.Read("Assets", "Asset"));
 
        resource.Add(m => m.OwnerID)
            .Title("Owner")
            .DataTextField("DisplayName")
            .DataValueField("UserID")
            .DataSource(ds => ds.Read("Users", "Users"));
 
        resource.Add(m => m.WorkTypeID)
            .Title("Work Type")
            .DataTextField("Name")
            .DataValueField("WorkTypeID")
            .DataSource(ds => ds.Read("WorkTypes", "MaintenanceSchedule"));
 
    })
    .DataSource(d => d
        .Model(m =>
        {
            m.Id(f => f.TaskID);
            m.Field(f => f.Title).DefaultValue("No title");
            m.Field(f => f.OwnerName);
            m.Field(f => f.AssetName);
            m.RecurrenceId(f => f.RecurrenceID);
        })
        .Read("TaskAssetRead", "Scheduler")
        .Create("TaskAssetCreate", "Scheduler")
        .Destroy("TaskAssetDestroy", "Scheduler")
        .Update("TaskAssetUpdate", "Scheduler")
        //.Events(events => events.Error("error_handler"))
    )
    .Events(events => events.Edit("edit"))
)

My model is:

[DataContract]
    public class TaskAsset : ISchedulerEvent
    {
        /// <summary>The start.</summary>
        [DataMember]
        private DateTime m_start;
 
        /// <summary>The end.</summary>
        [DataMember]
        private DateTime m_end;
 
        /// <summary>Gets or sets the task id.</summary>
        [DataMember]
        public int TaskID { get; set; }
 
        /// <summary>Gets or sets the <see cref="Asset"/> id.</summary>
        [DataMember]
        [Required]
        public int AssetID { get; set; }
 
        /// <summary>Gets or sets the <see cref="Asset"/> name.</summary>
        [DataMember]
        public string AssetName { get; set; }
 
        /// <summary>Gets or sets the description.</summary>
        [DataMember]
        public string Description { get; set; }
 
        /// <summary>Gets or sets the owner id.</summary>
        [DataMember]
        [Required]
        public Guid? OwnerID { get; set; }
 
        /// <summary>Gets or sets the owner name.</summary>
        [DataMember]
        public string OwnerName { get; set; }
 
        /// <summary>Gets or sets the end.</summary>
        [DataMember]
        public DateTime End
        {
            get
            {
                return this.m_end;
            }
            set
            {
                this.m_end = value.ToUniversalTime();
            }
        }
 
        /// <summary>Gets or sets the end time zone.</summary>
        [DataMember]
        public string EndTimezone { get; set; }
 
        /// <summary>Gets or sets a value indicating whether is all day.</summary>
        [DataMember]
        public bool IsAllDay { get; set; }
 
        /// <summary>Gets or sets the recurrence exception.</summary>
        [DataMember]
        public string RecurrenceException { get; set; }
 
        /// <summary>Gets or sets the recurrence rule.</summary>
        [DataMember]
        public string RecurrenceRule { get; set; }
 
        /// <summary>Gets or sets the start.</summary>
        [DataMember]
        public DateTime Start
        {
            get
            {
                return this.m_start;
            }
            set
            {
                this.m_start = value.ToUniversalTime();
            }
        }
 
        /// <summary>Gets or sets the start time zone.</summary>
        [DataMember]
        public string StartTimezone { get; set; }
 
        /// <summary>Gets or sets the title.</summary>
        [DataMember]
        public string Title { get; set; }
 
        /// <summary>Gets or sets the recurrence id.</summary>
        [DataMember]
        public int? RecurrenceID { get; set; }
 
        /// <summary>Gets or sets the create date.</summary>
        [DataMember]
        public DateTime CreateDate { get; set; }
 
        /// <summary>Gets or sets the create user.</summary>
        [DataMember(IsRequired = false)]
        public Guid? CreateUser { get; set; }
 
        /// <summary>Gets or sets the <see cref="WorkType"/> id.</summary>
        [DataMember]
        [Required]
        public int WorkTypeID { get; set; }
}


Can this be done?
0
Accepted
Georgi Krustev
Telerik team
answered on 04 Sep 2014, 10:54 AM
Hello Matt,

In general, the widget knows how to update the AssetID (I will focus only on this event property), because this is specifically defined in the Resources method, but AssetName is unknown to it. When a new event is created I suppose that you are querying the DB to get the AssetName based on the AssetID. Thus when you refresh the page all events have the correct AssetID and AssetName set. If this is the case, then the AssetName is NULL after create/update because the service responsible for update/create does not return the correctly updated event. Here is a screencast of a test project (project is attached to this message), which demonstrates that additional property is shown if the event is correctly updated on create. Could you please modify it to reproduce the problem? This will help us to understand your current implementation and advice you further.

Regards,
Georgi Krustev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Edward
Top achievements
Rank 1
answered on 04 Sep 2014, 12:04 PM
Thanks Georgi. Your reply helped.
Tags
Scheduler
Asked by
Edward
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Edward
Top achievements
Rank 1
Share this question
or