Telerik Forums
Kendo UI for jQuery Forum
2 answers
55 views
Hi,

I'm trying to set a type on a property on my nested schema.
In the column template on my KendoUI Grid, I'm binding to the datafield "Month1.EHR".
How do I set that column to be a "number" in my schema model?

I've tried the below, and many other variations, but nothing I've tried has worked.
dataSource: {
    type: "aspnetmvc-ajax",
    transport: {
        read: {
            url: "@Url.Action("_GetEHR", "Performance")", type: "POST",
            contentType: "application/json",
            data: //searchOptions()
            {
                periodDate: function () { return kendo.toString($("#periodDate").data("kendoDatePicker").value(), "MMM yyyy") }
            }
        },
        parameterMap: function (options) {
            return JSON.stringify(options);
        }
    },
    serverSorting: true,
    serverFiltering: true,
    serverPaging: true,
    pageSize: 50,
    schema: {
        model: {
            fields: {
                AccountName: { type: "string" },
                Month1: { EHR: { type: "number" } },
                Month2: { EHR: { type: "number" } },
                Month3: { EHR: { type: "number" } },
                Month4: { EHR: { type: "number" } },
                Month5: { EHR: { type: "number" } },
                Month6: { EHR: { type: "number" } },
                Month7: { EHR: { type: "number" } },
                Month8: { EHR: { type: "number" } },
                Month9: { EHR: { type: "number" } },
                Month10: { EHR: { type: "number" } },
                Month11: { EHR: { type: "number" } },
                Month12: { EHR: { type: "number" } }
            }
        },
        data: function (data) {
            return data.Data;
        },
        total: function (data) {
            return data.Total;
        }
    },
},
Thanks.
RGTech
Top achievements
Rank 1
 answered on 10 May 2013
1 answer
62 views
What information drives the percent complete attribute that drives how full the progress bar is? For some reason the bar is moving extremely quickly for my uploads (much faster than the upload is actually happening) and I was hoping that by better understanding the mechanism, I might be better able to figure out what is actually going on.

Thanks!
Jacob
T. Tsonev
Telerik team
 answered on 10 May 2013
1 answer
205 views
I am trying to configure a kendo line chart using MVVM.  I am binding it to a ObservableObject.

            var viewModel = kendo.observable({
                issues: [
                    { month: new Date('1/1/2013'), cnt: 10 },
                    { month: new Date('2/1/2013'), cnt: 20 },
                    { month: new Date('3/1/2013'), cnt: 30 },
                    { month: new Date('4/1/2013'), cnt: 20 },
                    { month: new Date('5/1/2013'), cnt: 10 }
                ],
                cancels: [
                    { month: new Date('1/1/2013'), cnt: 5 },
                    { month: new Date('2/1/2013'), cnt: 10 },
                    { month: new Date('3/1/2013'), cnt: 15 },
                    { month: new Date('4/1/2013'), cnt: 10 },
                    { month: new Date('5/1/2013'), cnt: 5 }
                ]
            });

When I specify the data-bind attribute as "source: issues" I get a single series plotted on the chart..

My question is how can I bind the chart to plot both the "issues" data and "cancels" data from the ObservableObject
Iliana Dyankova
Telerik team
 answered on 10 May 2013
1 answer
63 views
Is there any sample that shows how we can disable calendar dates that falls outside certain date range(Min-Max) with X marker or grayed out as shown in attachment?
Iliana Dyankova
Telerik team
 answered on 10 May 2013
1 answer
181 views
Hi,

I have a Kendo grid and am using MVVM binding, I have CRUD operations defined. Everything works fine with out exception I never get a confirmation message when deleting a row.

I have the Grid editable property set to:
editable: { "mode": "popup" }

If I change this to:
editable: "popup"

Then I successfully get the delete confirmation message.

However I need to retain the first method as I want to use a template like below:
editable: { "mode": "popup", "template": $("#popup_editor").html() },

Any ideas why the confirmation message doesn't appear.  Also If I do the following
editable: { "mode": "popup", confirmation: "Are you sure" }

Then it functions correctly.  I'd prefer not to have to do this for localisation reasons.

Thanks,
Keith
Alexander Valchev
Telerik team
 answered on 10 May 2013
1 answer
79 views
In order to flatten my data and avoid circular references, I created a view model for an object generated by OpenAccess ORM. I noticed something interesting, though. When binding the grid to my new view model (Html.Kendo().Grid<ViewModel>()...), my DateTime fields get converted into JSON dates when the grid is rendered (e.g. /Date(1362974400000)/). However, when I bind the grid to the original model (Html.Kendo().Grid<OpenAccessModel>()...), the dates come out as expected (e.g. Mon Mar 11 2013 00:00:00 GMT-0400 (Eastern Daylight Time)).

I've manipulated the code so that I've isolated the binding as the only difference. There's something different about the two classes that is causing a difference in rendering of the date field (even though that field is a DateTime field for both classes). Any idea why this is happening and if there's a simple way to fix this? Perhaps a bit of metadata attached to the field through OpenAccess that I should include in the view model?

Thanks!
Daniel
Telerik team
 answered on 10 May 2013
1 answer
1.1K+ views
I am having a problem with Kendo UI Grid. I am able to read data from the server. But when I update, create or delete a row in the grid, it is redirecting only to “Create”. Below is my code in jQuery/JS and ASP.NET :
 
.CSHTML CODE

$("#employeesGrid").kendoGrid({
        toolbar: ["create"],
        // dataSource: myDataSource2,
        dataSource: new kendo.data.DataSource({
            transport: {
                read: { url: "@Url.Action("GetEmployeesList","Employee")" },
                update: {url: "@Url.Action("UpdateEmployee", "Employee")" },
                destroy: { url: "@Url.Action("DeleteEmployee", "Employee")" },
                create: {url: "@Url.Action("CreateEmployee", "Employee")" }            
            },
            schema: {
                model: {
                    fields: {
                        FirstName: { editable: false},
                        DOB: { type: "date"},
                        Created: {type: "date" },
                        Updated: {type: "date" },
                    }
                }
            },
            pageSize : 3,
            serverPaging : true
        }),
        columns: [
            { field: "FirstName", title: "First Name" },
            { field: "LastName", title: "Last Name"},
            { field: "DOB", title: "Date of Birth", format: "{0:dd/MM/yyyy}" },
            { 
                field: "Role", title: "Role", values: [
                            { text: "Software Engineer", value: "Software Engineer"},
                            { text: "Team Lead", value: "Team Lead"},
                            { text: "Project Manager", value: "Project Manager"},
                            { text: "Technical Architect", value: "Technical Architect"},
                            { text: "Other", value: "Other"}
                ] 
            },
            { field: "Enabled", title: "Enabled" },
            { command: ["edit", "destroy"], title: "&nbsp;", width: "172px" }
        ],
        filterable: true,
        sortable: true,
        pageable: true,
        editable: "popup"
    });
});

 
ASP.NET Controller Code :
[HttpGet]
public JsonResult GetEmployeesList(int take, int skip, int page, int pageSize)
{
var em = (from e in es.Find()
                     select e.ToModel()).Skip(skip).Take(take).ToList();
return Json(em, JsonRequestBehavior.AllowGet);
}
 
public JsonResult UpdateEmployee(EmployeeModel empModel)
{

}
 
public JsonResult CreateEmployee(EmployeeModel empModel)
{

}
 
public JsonResult DeleteEmployee(EmployeeModel empModel)
{

}
 
I placed breakpoints, the kendo ui grid code only goes to CreateEmployee method for create, update and delete operations. 
Alexander Valchev
Telerik team
 answered on 10 May 2013
1 answer
489 views
i'm trying to bind a grid with hireachical data from server
i read the by  entityframework and the output on the client is the follow:
{"GetDocumentsResult":[{"AnnoEsercizio":2013,"BatchID":636614,"CustomerDocumentTypeID":401,"Data":"\/Date(1366236000000+0200)\/","FileExtension":".jpg","FollowUp":{"Fk_ID_ressol":11,"FollowUp1":"\/Date(1367877600000+0200)\/","FollowUp2":null,"FollowUp3":null,"Id":4,"Note":null},"Frequenza":"MENSILE","Id":4,"Nota":null,"ObjectID":"1","PathBuildingRuleID":9,"Piva":"xdfdff","RagioneSociale":"Kellner","RepositoryRegistrationDate":"\/Date(1358463600000+0100)\/","Stato":"OK"},{"AnnoEsercizio":2013,"BatchID":636614,"CustomerDocumentTypeID":401,"Data":"\/Date(1361142000000+0100)\/","FileExtension":".jpg","FollowUp":null,"Frequenza":"MENSILE","Id":5,"Nota":null,"ObjectID":"2","PathBuildingRuleID":9,"Piva":"xdfdff","RagioneSociale":"Kellner","RepositoryRegistrationDate":"\/Date(1366236000000+0200)\/","Stato":"OK"},{"AnnoEsercizio":2013,"BatchID":636614,"CustomerDocumentTypeID":401,"Data":"\/Date(1363561200000+0100)\/","FileExtension":".jpg","FollowUp":null,"Frequenza":"MENSILE","Id":6,"Nota":null,"ObjectID":"3","PathBuildingRuleID":9,"Piva":"xdfdff","RagioneSociale":"Kellner","RepositoryRegistrationDate":"\/Date(1366236000000+0200)\/","Stato":"OK"},{"AnnoEsercizio":2013,"BatchID":636614,"CustomerDocumentTypeID":401,"Data":"\/Date(1366236000000+0200)\/","FileExtension":".jpg","FollowUp":null,"Frequenza":"MENSILE","Id":7,"Nota":null,"ObjectID":"4","PathBuildingRuleID":9,"Piva":"xdfdff","RagioneSociale":"Kellner","RepositoryRegistrationDate":"\/Date(1366236000000+0200)\/","Stato":"DA VERIFICARE"},{"AnnoEsercizio":2013,"BatchID":636614,"CustomerDocumentTypeID":401,"Data":"\/Date(1357081200000+0100)\/","FileExtension":".jpg","FollowUp":null,"Frequenza":"TRIMESTRALE","Id":11,"Nota":null,"ObjectID":"6","PathBuildingRuleID":9,"Piva":"12345678901","RagioneSociale":"Alessio","RepositoryRegistrationDate":"\/Date(1366236000000+0200)\/","Stato":"OK"}]}



there is a child collection (named "FollowUp" and has got an only one row) in this json output
the field "FollowUp" contains several properties:   FollowUp":{"Fk_ID_ressol":11,"FollowUp1":"\/Date(1367877600000+0200)\/","FollowUp2":null,"FollowUp3":null,"Id":4,"Note":null}

in my javascript i've tried to do the following:

---hirearchicaldatasource-----
Master._resSolDataSource = new kendo.data.HierarchicalDataSource({
        transport: {
            read: {
                beforeSend: function (xhr, s) {
                    s.data = JSON.stringify(Master._filter);
                },
                type: "POST",
                url: _rootUrl + 'wcf/ResponsabilitaSolidaleService.svc/getdocuments',
                contentType: "application/json; charset=utf-8",
                dataType: "json"
            }
        },
        schema: {
            data: "GetDocumentsResult",
            model: {
                id: "Id",
                fields: {
                    Id: { type: "number" },
                    Piva: { type: "string" },
                    RagioneSociale: { type: "string" },
                    Data: { type: "date" },
                    AnnoEsercizio: { type: "number" },
                    Frequenza: { type: "string" },
                    Stato: { type: "string" }
                },
                children: "FollowUp"
            }
        },
        group: { field: "RagioneSociale", dir: "asc" }
 
    });
 
------and in the grid-----
 
$("#adminGrid").kendoGrid({
        ........,
    ...other code....,
    .....,
        columns: [{
            field: "Id",
            hidden: true  
        }, {
            field: "Piva",
            title: "Partiva IVA"
        }, {
            field: "RagioneSociale",
            title: "Ragione Sociale"
        }, {
            field: "Data",
            format: "{0:dd/MM/yyyy}"
        }, {
            field: "AnnoEsercizio",
            title: "Anno esercizio"
        }, {
            field: "Frequenza"
        }, {
            field: "Stato"
        }, {
            command: [
                {
                    name: "download",
                    click: Master.download
                },
                {
                    name: "followup",
                    click: Master.followup
                }
            ],
            title: " "
        }, {
            field: "FollowUp[0].FollowUp1",       //<--FollowUp seems to be null
            title: "fu1 child"
        }]
 
    });



give exception here because the parameter "data.FollowUp.FollowUp1" doesn't exist because data.FollowUp is null

(code generated by visuatudio debugger from kendo.web.min.js)
function anonymous(data) {
var o,e=kendo.htmlEncode;with(data){o='<tr data-uid="'+(data.uid)+'" role=\'row\'><td class="k-group-cell"> </td><td style="display:none" role=\'gridcell\'>'+e(data.Id==null?'':data.Id)+'</td><td  role=\'gridcell\'>'+e(data.Piva==null?'':data.Piva)+'</td><td  role=\'gridcell\'>'+e(data.RagioneSociale==null?'':data.RagioneSociale)+'</td><td  role=\'gridcell\'>'+e(kendo.format("{0:dd/MM/yyyy}",data.Data==null?'':data.Data))+'</td><td  role=\'gridcell\'>'+e(data.AnnoEsercizio==null?'':data.AnnoEsercizio)+'</td><td  role=\'gridcell\'>'+e(data.Frequenza==null?'':data.Frequenza)+'</td><td  role=\'gridcell\'>'+e(data.Stato==null?'':data.Stato)+'</td><td  role=\'gridcell\'><a class="k-button k-button-icontext k-grid-download"  href="#"><span class=" "></span>download</a><a class="k-button k-button-icontext k-grid-followup"  href="#"><span class=" "></span>followup</a></td><td  role=\'gridcell\'>'+e(data.FollowUp.FollowUp1==null?'':data.FollowUp.FollowUp1)+'</td></tr>';}return o;
}


it looks like that this datasource doesn't expose the property "FollowUp" at all!
could you help me to understand, please!
Alessio.
Alex Gyoshev
Telerik team
 answered on 10 May 2013
2 answers
126 views
Hello,
I'm working on a sample form to understand how to work with KendoUI, Asp.net MVC3 and MySql database.
I have created the form as a View on Create action of the controller but I cant seem to get the model to store the data inputed into the form.
 I need to know how to link the Kendo control to my model.

Create.cshtml
@model MvcApplication_Movie.Models.movie_master
@{
    ViewBag.Title = "Create";
}
<h2>Add New Movie</h2>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
                <h3>Movie Name:</h3>
                <input type="text" id="movie_name" class="k-textbox"/>
                
                 <br />

                <h3>Release Date:</h3>
                 @(Html.Kendo().DatePicker()
                              .Name("datepicker")
                              .HtmlAttributes(new { style = "width:150px" })
                  )

                <br />

               <h3>Movie Poster:</h3>
                @(Html.Kendo().Upload().Name("files"))

                 <br />

               <input type="submit" id="submit" onclick="ins_mod()" value="Add Movie" class="k-button" />
    </fieldset>
}

The controller method
[HttpPost]
        public ActionResult Create(movie_master movie_record)
        {
            
            try
            {
                // Insert Movie logic here
                using (var insert = new moviesEntities())
                {
                    insert.movie_master.Add(movie_record);
                    insert.SaveChanges();
                }
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

Please help me asap. Thank you
Daniel
Telerik team
 answered on 10 May 2013
9 answers
134 views
Hello,
I have a problem with the method stopEndlessScrolling, what happens is that initially I load my data well (image1). when I go down scroller, it still works well because I have yet to send me the data server (image2). When the server has no more data to send me what I do is stop the scroller with stopEndlessScrolling method after that the scroll is lost and fails to display the data (image3). Additionally, it is assumed that the endless scrolling a request each time scroll down the page by changing the number, but I can see that after there is no more data to bring the server, makes many requests and I do not understand why. This is my code:

<div data-role="view"
    data-title="Art de inventario"
    data-layout="layout_inventory"
        data-init="filterableInventoryList"
         data-model="inventoryModel">
 
    <ul  id="inventoryList"
        data-role="listview"
    </ul>
</div>
 
<script id="inventoryTemplate" type="text/x-kendo-template">
      <div class="row">
            <img class="pullImage" src="#=Photo#"  />#= Name #
          <div class="metadata">
                <span class="sublink" >Código :  #=Code#</span>
          </div>
       </div>
</script>
function filterableInventoryList(e){
             var wid = $(window).width();
             var dataSource = new kendo.data.DataSource({
                    pageSize: 12,
                    serverPaging: true,
                    serverFiltering: true,
                    transport: {
                        read:{
                            url:  localStorage.getItem("url") + "GetInventoryItems",
                            dataType: "json",
                            contentType: "application/json; charset=utf-8"
                        },
                        parameterMap: function(options) {
                            var b = selectMenuModel.get("branch");
                            var filter = options.filter ? options.filter.filters[0].value : "";
                            var parameters = {
                                url: JSON.stringify(localStorage.getItem("url")),
                                width : wid,
                                branchId : JSON.stringify(b.Branch_Id),
                                q: JSON.stringify(filter),
                                count: options.pageSize,
                                page: options.page
                            }
 
                            return parameters;
                        }
                    },
                    schema: { // describe the result format
                        data: "d", // the data which the data source will be bound to is in the "results" field
                        model : {  ...
                    },
                    change: function() {
                        //check whether any data is returned
                        if (!this.view()[0]) {
                              //disable endless scroll
                         $("#inventoryList").data("kendoMobileListView").stopEndlessScrolling();
                        }
                    }
                });
 
 
            $("#inventoryList").kendoMobileListView({
                dataSource: dataSource,
                template: $("#inventoryTemplate").text(),
                filterable: {
                    filterable: true,
                    placeholder: "Buscar Item..."
                },
                endlessScroll: true,
                scrollTreshold: 30 //treshold in pixels
            });
    }


Georgi Krustev
Telerik team
 answered on 10 May 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?