Telerik Forums
UI for ASP.NET MVC Forum
3 answers
150 views
Hi,

I am trying to configure a scheduler.

I want to customise each day in the 'month' view, to work with my datasource.
for example: if i want to add a div with the background black or blue then it depends on the field "title" in my datasource etc...

I am having problems configuring my datasource. For some reason I do not see the data returned from the server appearing on my scheduler.

I am tearing out my hair !!!!

Attached it the code I am using for reference.

Please help !!! Where am I going wrong?

Thanks,

Jack.







<script id="editor" type="text/x-kendo-template">


    @*<span class='k-link k-nav-day'>#=kendo.toString(date, 'dd')#</span>*@
    <div>dddd</div>
    <div>#: title #</div>
</script>


<script id="editor2" type="text/x-kendo-template">


    <div>#: title #</div>
<h3>aaaa</h3>
<p>
   <label>Title: <input name="title" /></label>
</p>
<p>
   <label>Start: <input data-role="datetimepicker" name="start" /></label>
</p>
<p>
   <label>Start: <input data-role="datetimepicker" name="end" /></label>
</p>
</script>




<script>
    var tempContent = $("#editor").html();
    var template = kendo.template(tempContent);


    $("#scheduler").kendoScheduler({
            date: new Date(2014, 4, 2, 0, 0, 0, 0),
            startTime: new Date("2014/6/13 00:00 AM"),
            //height: 600,
            views: [
                {
                    type: "day",
                    dateHeaderTemplate: kendo.template("<u>#=kendo.toString(date,'d')#</u>")
                },
                {
                    type: "month",
                    dayTemplate: kendo.template("<span class='k-link k-nav-day'>#=kendo.toString(date, 'dd')#</span><div>aaaa</div>")/*template(template)*/,
                    dayHeaderTemplate: kendo.template("<u>#=kendo.toString(date,'ddd')#</u>")
                    
                }
            ],
            selectable:true,
            timezone: "Etc/UTC",
            //dataSource: [
            //{
            //    id:1,
            //    title: "Fast and furious 6",
            //    image: "../../content/web/scheduler/fast-and-furious.jpg",
            //    imdb: "http://www.imdb.com/title/tt1905041/",
            //    start: new Date("2014/6/13 17:00"),
            //    end: new Date("2014/6/13 18:30")
            //},
            //{
            //    id:2,
            //    title: "The Internship",
            //    image: "../../content/web/scheduler/the-internship.jpg",
            //    imdb: "http://www.imdb.com/title/tt2234155/",
            //    start: new Date("2014/6/14 14:00"),
            //    end: new Date("2014/6/14 15:30")
            //}
            //],
            editable: {
                template: $("#editor2").html()
            },


            dataSource: {
                batch: true,
                transport: {
                    read: {
                        url: "@Url.Action("Read","OmittedDaysScheduler",new { brnEntID=ViewBag.BranchEntityID})",
                        dataType: "jsonp"
                    },
                    update: {
                        url: "@Url.Action("Update","OmittedDaysScheduler")",
                        dataType: "jsonp"


                    },
                    create: {
                        url: "@Url.Action("Create","OmittedDaysScheduler")",
                        dataType: "jsonp"


                    },
                    destroy: {
                        url: "@Url.Action("Destroy","OmittedDaysScheduler")",
                        dataType: "jsonp"


                    },
                    parameterMap: function (options, operation) {
                        if (operation !== "read" && options.models) {
                            return { models: kendo.stringify(options.models) };
                        }
                    }
                },
                schema: {
                    model: {
                        id: { type: "number", from: "ID" },
                        fields: {
                            taskId: {from: "ID", type: "number"},
                            title: { from: "Title", defaultValue: "No title" },
                            start: { type: "date", from: "Start" },
                            end: { type: "date", from: "End" },
                            startTimezone: { from: "StartTimezone" },
                            endTimezone: { from: "EndTimezone" },
                            description: { from: "Description" },
                            recurrenceId: { from: "RecurrenceID" },
                            recurrenceRule: { from: "RecurrenceRule" },
                            recurrenceException: { from: "RecurrenceException" },
                            isAllDay: { type: "boolean", from: "IsAllDay" }
                        }
                    }
                }
            }
        });
</script>


Here is the server response:

{"Data":[{"ID":6,"Description":null,"End":"\/Date(1396818000000)\/","EndTimezone":"UTC","IsAllDay":false,"RecurrenceException":"excep","RecurrenceRule":"rule","Start":"\/Date(1396818000000)\/","StartTimezone":"UTC","Title":"Number 1","TimeFrom":null,"TimeTo":null},{"ID":3,"Description":null,"End":"\/Date(1396339200000)\/","EndTimezone":"UTC","IsAllDay":false,"RecurrenceException":"excep","RecurrenceRule":"rule","Start":"\/Date(1396332000000)\/","StartTimezone":"UTC","Title":"Number 2","TimeFrom":{"Hours":7,"Minutes":39,"Seconds":0,"Milliseconds":0,"Ticks":275400000000,"Days":0,"TotalDays":0.31875,"TotalHours":7.6499999999999995,"TotalMilliseconds":27540000,"TotalMinutes":459,"TotalSeconds":27540},"TimeTo":{"Hours":9,"Minutes":39,"Seconds":0,"Milliseconds":0,"Ticks":347400000000,"Days":0,"TotalDays":0.40208333333333329,"TotalHours":9.65,"TotalMilliseconds":34740000,"TotalMinutes":579,"TotalSeconds":34740}}],"Total":2,"AggregateResults":null,"Errors":null}








Alexander Popov
Telerik team
 answered on 09 May 2014
1 answer
112 views
I am trying to use hierarchy with the data that is in the model.  However, when the grid loads, the first column is not the expand/collapse, it is the first data bound column and all other columns are shifted left.  If I exclude the client template, it works fine, but as soon as I add the template call, it breaks.
@(Html.Kendo().Grid<SHDIncident>(Model.SHDActive)
               .Name("shdActive")
               .Columns(columns =>
               {
                   columns.Bound(e => e.SHDEntryId);
                   columns.Bound(e => e.AffectedWorkload);
                   columns.Bound(e => e.Severity);
                   columns.Bound(e => e.Status);
                   columns.Bound(e => e.AffectedDataCenters);
                   columns.Bound(e => e.StartTime);
                   columns.Bound(e => e.LastUpdatedTime);
               })
               .ClientDetailTemplateId("shddetailTemplate")
           )
Nikolay Rusev
Telerik team
 answered on 09 May 2014
1 answer
79 views
I noticed on the online demo as well as my own charts that "Pan & Zoom" charts don't react to touch devices such as an iPad.  Is there a future release or any requests to have the feature fixed/added?
T. Tsonev
Telerik team
 answered on 08 May 2014
1 answer
87 views
I have a problem on sorting and filtering in grid. I already read and tried some threads in this forums but still not working.

I hope you could help me on this.

Thank you and God bless...

Here's my code below:

Html.Kendo().Grid(Of SPIMS.ViewModel.EventViewModel.Index)() _
.Name("grid") _
.Columns(Sub(c)
c.Bound(Function(p) p.ID).HeaderHtmlAttributes(New With {.style = "text-align: center; font-weight: bold"}).Width(10)
c.Bound(Function(p) p.CreatedDate).Format("{0:dd/MM/yyyy}").Width(20).Title("Date").HeaderHtmlAttributes(New With {.style = "text-align: center; font-weight: bold"})
c.Bound(Function(p) p.Source).HeaderHtmlAttributes(New With {.style = "text-align: center; font-weight: bold"}).Width(20)
c.Bound(Function(p) p.Message).HeaderHtmlAttributes(New With {.style = "text-align: center; font-weight: bold"}).Width(50).Title("Description")
c.Command(Sub(commands)
commands.Custom("View").Click("showDetails")
End Sub).Title(" ").Width(10)
End Sub) _
.Scrollable() _
.Sortable _
.Filterable() _
.Pageable(Sub(pager)
pager.Input(True)
pager.Numeric(True)
pager.Input(True)
pager.PreviousNext(True)
pager.Refresh(True)
pager.PageSizes(True)
pager.ButtonCount(10)
End Sub) _
.HtmlAttributes(New With {.style = "height:450px;width:900px;"}) _
.DataSource(Sub(d)
d.Ajax() _
.PageSize(10) _
.Model(Sub(model) model.Id(Function(p) p.ID)) _
.ServerOperation(True) _
.Read(Function(read) read.Action("Model_Read", "Event"))
End Sub).Render()
Alexander Popov
Telerik team
 answered on 08 May 2014
2 answers
103 views
I am currently using the latest internal build and have noticed that Chrome (34.0.1847.131) seems to be treating the wrapped drop downs differently to say internet explorer 11. I have attached an image showing the difference.

I have also observed this style issue with the drop down for the text formatting tool.

I'm not sure if this just because I am using the latest internal release. This issue is not presented in the 2014.1.416 build but is in the 2014.1.423 build.

Jelly Master
Top achievements
Rank 1
 answered on 08 May 2014
1 answer
751 views
Hello,

I'm trying to set the value of the cascading dropdownlist, i want to set the value that the model have in the second dropdownlist. The value seems to be set, but only after i first click on the second dropdownlist then i get the right "name" in the list. Anything i'm doing wrong?
   <script>
                function contractorChanged() {
                    $.ajax({
                        type: "POST",
                        url: '@Url.Action("GetContactPersons", "Permission")',
                        data: {
                            id: $("#ContractorId").val()
                        },
                        cache: false,
                        success: function (data) {
                            $("#ContractorPersonId").data("kendoDropDownList").setDataSource(data);
                       $("#ContractorPersonId").data("kendoDropDownList").value('@Model.ContractorPersonId');
 
                        }
                    });
                }
 
            </script>           
 
@(Html.Kendo().DropDownListFor(model => model.ContractorId)
              .HtmlAttributes(new { style = "width:100%; margin-bottom: 8px;" })
              .OptionLabel("Välj företag")
              .DataTextField("Name")
              .DataValueField("Id")
              .Events(e => e.DataBound("contractorChanged"))
              .DataSource(source =>
              {
                  source.Read(read => { read.Action("GetConstructors", "Permission"); });
              }))
 
            @(Html.Kendo().DropDownListFor(model => model.ContractorPersonId)
              .HtmlAttributes(new { style = "width:100%" })
              .OptionLabel("Välj kontaktperson")
              .DataTextField("FullName")
              .DataValueField("Id")
              .Enable(false)
              .AutoBind(false)
              .CascadeFrom("ContractorId")
            )


Georgi Krustev
Telerik team
 answered on 08 May 2014
6 answers
234 views
Hi,

I have a splitter with a treeview in one vertical pane on the left.  When a user clicks an item in the treeview, I would like to load items in horizontal panes in the center.  Is this possible?
thank you,
Alex Gyoshev
Telerik team
 answered on 08 May 2014
1 answer
78 views
I am trying to use the drag and drop framework, but cant seem to get any events on the drop are, such as dragenter.

am I missing something? thanks

<div class="draggable">
    drag me
</div>
<div  id="test-area">
    <h2>
        Test area
    </h2>
    <h2>
        Test area
    </h2>
    <h2>
        Test area
    </h2>
    <h2>
        Test area
    </h2>
    <h2>
        Test area
    </h2>
    <h2>
        Test area
    </h2>
    <h2>
        Test area
    </h2>
</div>
 
<script>
 
    $(document).ready(function () {
    
        $("#test-area").kendoDropTargetArea({
            dragenter: DragAndDrop.dropTargetOnDragEnter,
            dragleave: DragAndDrop.dropTargetOnDragLeave,
            drop: DragAndDrop.dropTargetOnDrop
        });
 
        $(".draggable").kendoDraggable({
            hint: function () {
                return $(".draggable").clone();
            },
            dragstart: DragAndDrop.draggableOnDragStart,
            dragend: DragAndDrop.draggableOnDragEnd
        });
 
 
    });
 
 
    var DragAndDrop = {
        draggableOnDragStart: function (e) {
            $(".draggable").addClass("hollow");
            $(".draggable").css("cursor", "no-drop");
            e.currentTarget.hide();
 
        },
        draggableOnDragEnd: function (e) {
            e.currentTarget.show();
 
        },
        dropTargetOnDrop: function () {
            alert(2);
 
        },
        dropTargetOnDragEnter: function () {
            alert(1);
            $(".draggable").css("cursor", "wait");
 
        },
        dropTargetOnDragLeave: function () {
            alert(3);
 
        }
    };
 
 
</script>
Alan Mosley
Top achievements
Rank 1
 answered on 08 May 2014
0 answers
111 views
Anyone know the best way to get my rows as a comma separated string?  I got it to work one way, but I think it returns too much data. I built an iqueryable sequence with a sub query. The sub query are the results want to transpose. Then I selected from the returned object and used string.join().  However, the first query repeats my main records and will waste bandwidth. For example (pseudo code):

Table1.Column1 Table1.Column2
1 John Smith

Table2.Column1 Table2.Column2
1 Blue
1 Green

var a = (from Table1 in context
select new Model {
Name = Table1.Column2,
Color = context.table2.where(x => x.Column1 == Table1.Column1).Select(x => x.Column2)
});

When executed a returns multiple names. e.g.

John Smith Blue
John Smith Green

the following does delimit it properly, however i'm concerned of the wasted bandwidth caused by the previous query.  

var b = a.Select(q => new Model
{Name = a.Name,
Color = string.join(",",a.Color)
});

The final result will be like this:

John Smith Blue, Green.

Should I make two connections to the sql server instead? Should I send an array of my IDs to sql or should I loop thru the first results then get the colors? Any suggestions would be great!  I prefer to keep using the DataSourceRequest object, rather than a custom stored procedure where I have to handle the paging/etc manually.  I hope this makes sense...
Gregory
Top achievements
Rank 1
 asked on 07 May 2014
2 answers
263 views
Is it possible to hide grid columns using the css from Bootstrap. I have the following grid control and the data hides as expected but the column names don't.

.Columns(c =>
    {
        c.Bound(col => col.ActiveBool).Width(12).Title("Active").HtmlAttributes(new { @class = "visible-xs visible-lg visible-sm" });
        c.Bound(col => col.District).Width(12).Title("Dist").HtmlAttributes(new { @class = "visible-xs visible-lg visible-sm" });
        c.Bound(col => col.ContractId).ClientTemplate(@Html.ActionLink("#= ContractId #", "ActiveContracts", "ActiveContracts", new { id = "#= ContractId #", @class = "visible-sm visible-lg visible-xs" }, null).ToHtmlString()).Width(16);
        c.Bound(col => col.Status).Width(23).HtmlAttributes(new { @class = "visible-lg" });
        c.Bound(col => col.WorkBeginDate).Width(17).Title("Work Begin").HtmlAttributes(new { @class = "visible-lg" });
        c.Bound(col => col.CurrentAmount).Width(20).HtmlAttributes(new { @class = "visible-lg" });
        c.Bound(col => col.ProjectId).Width(18).HtmlAttributes(new { @class = "visible-lg" });
        c.Bound(col => col.DescriptionTrimmed).Width(33).HtmlAttributes(new { title = "<#=Description#>" }).Title("Description").HtmlAttributes(new { @class = "visible-lg" });
        c.Bound(col => col.County).Width(15).HtmlAttributes(new { @class = "visible-lg" });
        c.Bound(col => col.WorkMixTrimmed).Width(22).HtmlAttributes(new { title = "<#=WorkMix#>" }).Title("Work Mix").HtmlAttributes(new { @class = "visible-lg" });
        c.Bound(col => col.VendorNameTrimmed).Width(22).HtmlAttributes(new { title = "<#=VendorName#>" }).Title("Vendor Name").HtmlAttributes(new { @class = "visible-xs  visible-lg  visible-sm" });
        c.Bound(col => col.ViewMap).Width(15).HtmlAttributes(new { @class = "visible-xs  visible-lg visible-sm" });
    })
Mike
Top achievements
Rank 1
 answered on 07 May 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?