Telerik Forums
Kendo UI for jQuery Forum
1 answer
85 views
I am creating an MVC 4 website.  Does the UIFramework and MVVM work WITH MVC or is it a replacement for MVC?
In other words, should I be using one or the other? Or both?

For example, I have a number of TextBoxs that I need to bind to create a Form.  Should I being using the Kendo Templates for this?  Or just use @Razor syntax.

I would prefer to just use Razor syntax, but I thought maybe I am mixing up the two technologies.
Greg Gum
Top achievements
Rank 1
 answered on 17 Dec 2013
9 answers
191 views
Hello,

I'm using the Kendo UI trial version and have been able to get the grid working correctly, however I'm seeing some weird behavior when the grid is rendered ( see attached ). Any idea what's causing this problem and how can I fix this?

Thanks.
Andrew
Top achievements
Rank 1
 answered on 17 Dec 2013
1 answer
733 views
Hi,
I am trying to use kendo datepicker inside a grid using editor template but when a select a date from date picker, it doesn't bind that selected date value to the grid and value remains the same as it was earlier. So I am not able to update the value for a particular field using datepicker inside kendogrid.
Here is my code:

This is my View part:


  @(Html.Kendo().Grid<PricePoint.Model.PriceSheet.PriceSheetHeader>()
                  .Name("Grid")
                  .Columns(columns =>
                  {

  columns.Bound(p => p.stateid).Title("[[[State]]]").Width(50);
                      columns.Bound(p => p.distributor).Title("[[[Distributor]]]").Width(100);
                      columns.Bound(p => p.whare_house_code).Title("[[[Warehouse Code]]]").Width(120);
                      columns.Bound(p => p.brand).Title("[[[Brand]]]").Width(100);
                      columns.Bound(p => p.item).Title("[[[Item]]]").Width(100);
                      columns.Bound(p => p.fob).Title("[[[FOB]]]").Width(50).Format("{0:" + ViewBag.GetAllFormat.currencyFormat + "}");
                      columns.Bound(p => p.pricesheetform_version_no).Title("[[[Form Version]]]").Width(50);
                      columns.Bound(p => p.startdate).Title("[[[Start Date]]]").Width(50).Format("{0:dd/MM/yyyy}").EditorTemplateName("DateTime");
                      columns.Bound(p => p.enddate).Title("[[[End Date]]]").Width(200).Format("{0:dd/MM/yyyy}").Width(170).EditorTemplateName("EditrTemp");
                     columns.Bound(p => p.createdate).Title("[[[Created On]]]").Width(50).Format("{0:" + ViewBag.GetAllFormat.dateFormat + "}");
                      columns.Bound(p => p.modifydate).Title("[[[Modified On]]]").Width(50).Format("{0:" + ViewBag.GetAllFormat.dateFormat + "}");
                      columns.Bound(p => p.createby).Title("[[[Created By]]]").Width(50);
                      columns.Bound(p => p.modifyby).Title("[[[Modified By]]]").Width(50);
                  }).ToolBar(toolBar =>
                                    {
                                      
                                        toolBar.Save();
                                        toolBar.Custom().Text("[[[Export To Excel]]]").HtmlAttributes(new { onclick = "javascript:ExportToExcel(event);", @class = "k-button" });
                                    })
                                        .Editable(editable => editable.Mode(GridEditMode.InCell))
                 .Events(ev=>ev.DataBound("db"))  
                  .Pageable(pageable =>
                  {
                      pageable.Refresh(true);
                      pageable.PageSizes(new int[] { 25, 50, 100, 200 });  
                      pageable.Messages(messages => messages.Empty("[[[No form found]]]"));
                  })
                  .Sortable()
                  .Filterable(f => f.Operators(o => o.ForString(fs =>
                              { fs.Clear().Contains("Contains");
                                fs.DoesNotContain("Does not contain");
                                fs.IsEqualTo("Equal to");
                                fs.IsNotEqualTo("Not equal to");
                                fs.StartsWith("Starts with");
                                fs.EndsWith("Ends with"); })))
                  .HtmlAttributes(new { style = "min-width: 1250px;" })
                  .DataSource(dataSource => dataSource
                      .Ajax()
                      .ServerOperation(false) // paging, sorting, filtering and grouping will be applied client-side
                      .Batch(true)
                      .Model(model =>
                      {
                          model.Id(p => p.pricesheetid);                                  
                      })
                
                      .Read("GetAllModifyPriceSheetAjax", "PriceSheet")
                      .Update(update => update.Action("UpdatePriceEntry", "PriceSheet"))
                        .PageSize(25)
                      .Events(events => events.Error("error_handler"))
                
                
                  )
                  )


This is the EditrTemp i am using for datepicker:

@model DateTime?

@(Html.Kendo().DatePickerFor
(m => m)
.Name("EditrTemp")
.Format("dd/MM/yyyy")
      )









Alexander Popov
Telerik team
 answered on 17 Dec 2013
7 answers
536 views
Hi Kendo Team:

Documentation says that kendo validator has a validate event that triggers when validation completes, but there's no sample in your demos.
Could you please provide any sample showing this?
Kind regards.
Oscar.
Kiril Nikolov
Telerik team
 answered on 17 Dec 2013
1 answer
38 views
I have created a Combobox that allows a user to search through a series of "Code - Description" options in order to select the "Code"...  The Code is what we wnat to have the user select but sometimes they need the description in order to pick the correct one.  I've set up the combobox so that they can start typing any three characters from the code or description and the dropdown list is then filtered to show options that match accordingly.

THis works most of the time, however sometimes the users just know the "Code", which is a 4 digit number.  If they just type in "1234" it doesn't actually "select" it in the combobox...  How can I get it to select the code if they type it into the box?

Thanks,
Jason
Kiril Nikolov
Telerik team
 answered on 17 Dec 2013
7 answers
1.9K+ views
I'm new to asp.net mvc as well as kendoui so this question may seem trivial (for both kendo and mvc).  But any help/explanation would be greatly appreciated.

I'm building a grid using the kendo ui mvc helper.  And there are many situations where I want to access item data.  I've figured out how to access it when created a template for a given cell as seen below.  

As you can, I've created a function to create a data attribute, and I would like to read that attribute from the database rather than hardcoding it.  Here is the code that I currently have.

    @functions
    {
        public static Dictionary<string, object> BuildGroupNameAttributes(string value)
        {
            var attributes = new Dictionary<string, object> { { "data-groupname", value } };
            return attributes;
        }
    }
    <div id="dotComDiv">
        @(Html.Kendo().Grid(Model)
              .Name("DotComGrid")
              
              .Columns(columns =>
              {                  
                  columns.Bound(p => p.GrossDemand.ThisYear).Title("TY").HeaderHtmlAttributes(BuildGroupNameAttributes("Gross Demand"));
                  columns.Bound(p => p.GrossDemand.ThisYear).Title("TY").HeaderHtmlAttributes(BuildGroupNameAttributes("Gross Demand")).Template(@<text>@string.Format("{0:0,0}", @item.GrossDemand.ThisYear)</text>);
   
              }).Scrollable(src => src.Height(500))
    
    
              )
    </div>

The line that I can't seem to work out is

    columns.Bound(p => p.GrossDemand.ThisYear).Title("TY").HeaderHtmlAttributes(BuildGroupNameAttributes("Gross Demand"));

Instead of hardcoding "Gross Demand" I want to read that from the bound item.  So like,


    columns.Bound(p => p.GrossDemand.ThisYear).Title("TY").HeaderHtmlAttributes(BuildGroupNameAttributes(@item.GroupName));

However, I can't access the item object like this.  But if you look at the template above, I'm able to access `@item` if it's wrapped in `@<text>`

Why is that, and how can I pass the item value to the function?

Thanks!


Vladimir Iliev
Telerik team
 answered on 17 Dec 2013
2 answers
86 views
Good day to you all.

I am developing an icenium app in which I get data from an SQL Server. Now I do want to split this data into three different views and display them with different initial sorting.

Kind of 

name   age    height    weight
Joe           33       180cm     80 kg
Jane         28       170cm    50 kg
Baby         1            50cm   9 kg


View 1 Grid with
name  age

View 2 Grid with
name height

View 3 Grid with
Name  weight

I have two problems

1) the initial sorting does only work with the give code below for the first view I load
2) sorting works only on the first view I sort.

Any advice. Should I make 3 different API calls or can it be handled dynamicly


Markus

<!-- Gemeinden  Steuerfüsse-->
 <div data-role="view" id="view-gemeinden-steuerfuesse" data-init="getGemeindeDaten('SteuerfussTotal')" data-layout="drawer-layout-gemeinden" data-title="Steuerfüsse" >
<div data-role="content" class="view-content" >
<div id="grid-gemeinden-steuerfuesse"></div>
</div>
</div>
         <!-- Gemeinden  Einwohner-->
 
        <div data-role="view" id="view-gemeinden-einwohner" data-init="getGemeindeDaten('Einwohner')" data-layout="drawer-layout-gemeinden" data-title="Einwohnerzahlen" >
<div data-role="content" class="view-content" >
<div id="grid-gemeinden-einwohner"></div>
</div>
</div>
         
         <!-- Gemeinden  Ausländeranetiel-->
 
        <div data-role="view" id="view-gemeinden-auslaender" data-init="getGemeindeDaten('Auslaenderanteil')" data-layout="drawer-layout-gemeinden" data-title="Ausländeranteil" >
<div data-role="content" class="view-content" >
<div id="grid-gemeinden-auslaender"></div>
</div>
</div>


function getGemeindeDaten(sortBy) {
    var dataSource = new kendo.data.DataSource({
        type: "json",
        transport: {
            read: {
                url: "http://mobile.mydomain.com/api/t_gemeindens/GetSteuerfuesse",
                data:{
                    Accept: "application/json"
                }
            }
        },
           
        sort: {field: sortBy, dir: "asc"},
    });
 
    $("#grid-gemeinden-steuerfuesse").kendoGrid({
        dataSource: dataSource,
        sortable: true,
               columns: [
            {
                field: "Gemeinde",
                title: "Gemeinde",
                width: 150,
                attributes: {
       
                    style: "text-align: left; font-size: 0.8em; "
                },
                headerAttributes: {
       
                    style: "text-align: left; font-size: 1em; "
                }
            }, {
                field: "SteuerfussJahr",
                title: "  Jahr",
                width: 90,
                 
                attributes: {
       
                    style: "text-align: left; font-size: 0.8em; "
                },
                headerAttributes: {
                    style: "text-align: left; font-size: 1em; "
                }
            }, {
                field: "SteuerfussTotal",
                title: "Total",
                width: 90
            }
            , {
                template: "<a href='http://www.web.statistik.zh.ch/cms_gp_neu/gpzh/index.php?p=gp&gem=#= Statistiklink #' target='_blank' style='font-size:0.8em;'>Quelle</a>",
                title: "Quelle"
            }
         
        ]
          
    });
    $("#grid-gemeinden-einwohner").kendoGrid({
        dataSource: dataSource,
        sortable: true,
        columns: [
            {
                field: "Gemeinde",
                title: "Gemeinde",
                width: 150,
                attributes: {
       
                    style: "text-align: left; font-size: 0.8em; "
                },
                headerAttributes: {
       
                    style: "text-align: left; font-size: 1em; "
                }
            }, {
                field: "Einwohner",
                title: "Einwohner",
                width: 90,
                 attributes: {
       
                    style: "text-align: left;k font-size: 0.8em; "
                },
                headerAttributes: {
       
                    style: "text-align: left; font-size: 1em; "
                }
            }
            , {
                template: "<a href='http://www.web.statistik.zh.ch/cms_gp_neu/gpzh/index.php?p=gp&gem=#= Statistiklink #' target='_blank' style='font-size:0.8em;'>Quelle</a>",
                title: "Quelle"
            }
         
        ]
          
    });
    $("#grid-gemeinden-auslaender").kendoGrid({
        dataSource: dataSource,
        sortable: true,
              columns: [
            {
                field: "Gemeinde",
                title: "Gemeinde",
                width: 120,
                attributes: {
       
                    style: "text-align: left; font-size: 0.8em; "
                },
                headerAttributes: {
       
                    style: "text-align: left; font-size: 1em; "
                }
            }, {
                template: "#=Auslaenderanteil# %",
                 field: "Auslaenderanteil",
                title: "2012",
                width: 70,
                 attributes: {
       
                    style: "text-align: right; font-size: 0.8em;padding-right:10px;"
                },
                  headerAttributes: {
       
                   style: "text-align: right; font-size: 1em;padding-right:10px;"
                }
            }
            , {
                template: "<a href='http://www.web.statistik.zh.ch/cms_gp_neu/gpzh/index.php?p=gp&gem=#= Statistiklink #' target='_blank'  style='font-size:0.8em;'>Quelle</a>",
                title: "Quelle",
                 
                 attributes: {
       
                    style: "text-align: right; font-size: 0.8em;padding-right:10px;"
                },
                  headerAttributes: {
       
                   style: "text-align: right; font-size: 1em;padding-right:10px;"
                }
            }
         
        ]
          
    });








Markus
Top achievements
Rank 2
 answered on 17 Dec 2013
1 answer
274 views
Hello, Kendo Team
  I'm studying Kendo UI Mobile data binding features and has a problem,when define a parse function for  kendo.data.Model  in "fields" section,the function has not triggered when create a new instance of the Model.
var Person = kendo.data.Model.define({
    fields: {
        name: {
            editable: true,
            from:"name",
            parse:function(v){
               console.log('parse name..., v=' + v);
               return v;
            }
        },
        age:{
        type:"number"
        }
    }
});
 
 
 
var person = new Person( {
    name: "John Doe",
    age: 42
});
In above code,the parse function is not triggered when create a new Person.
My question is:
How about he parse function works, any advices for parse function usage?
Atanas Korchev
Telerik team
 answered on 17 Dec 2013
5 answers
265 views
Hello,
I'm trying to add sorting to a DataSource, which generally is working just fine. The only problem is that it seems the sort mode is case sensitive.

If you check out this Fiddle: http://jsfiddle.net/EaNm4/ 
You will see what I mean. ('Alphy' is at the beginning of the list, while 'alpha' is at the end of the list). Is there a way I can specify my own sort algorithm or a way to make the default one case insensitive? I've checked the docs but I'm having a hard time finding anything.
Atanas Korchev
Telerik team
 answered on 17 Dec 2013
10 answers
630 views
Hi, I wrote kendo Grid control in javascript application; I had needed implement server-side grouping, but I couldn't turn it on eventually. Server sorting, and filtering already works, perhaps I am doing something wrong in a render-control-code; here it is:

01.jQuery(ORDER_GRID_ID).kendoGrid({
02.                "change": XX.OrderGrid_Change,
03.                "columns": [{
04.                    "title": XX.Title,
05.                    "width": "120px",
06.                    "field": "number",
07.                    "filterable": true,
08.                    "encoded": true
09.                },
10.                {
11.                    "title": XX.Title1,
12.                    "width": "200px",
13.                    "field": "status",
14.                    "filterable": true,
15.                    "encoded": true
16.                },
17.                {
18.                    "title": XX.Title2,
19.                    "width": "100px",
20.                    "field": "orderDate",
21.                    "format": "{0: yyyy/MM/dd}",
22.                    "filterable": true,
23.                    "encoded": true
24.                },
25.                {
26.                    "title": XX.Title3,
27.                    "width": "100px",
28.                    "field": "deliveryDate",
29.                    "format": "{0: yyyy/MM/dd}",
30.                    "filterable": true,
31.                    "encoded": true
32.                },
33.                {
34.                    "title": XX.Title4,
35.                    "width": "200px",
36.                    "field": "customer.userName",
37.                    "filterable": true,
38.                    "encoded": true
39.                },
40.                {
41.                    "title": XX.Title5,
42.                    "template": "#=totalRequested()# EUR",
43.                    "field": "totalRequested()",
44.                    "filterable": true,
45.                    "encoded": true
46.                }],
47.                "groupable": true,
48.                "pageable": {
49.                    "input": true,
50.                    "refresh": true,
51.                    "pageSizes": [2, 5, 10, 100],
52.                    "buttonCount": 10
53.                },
54.                "scrollable": {
55.                    "virtual": true
56.                },
57.                "sortable": true,
58.                "selectable": "Single, Row",
59.                "toolbar": [{
60.                    "template": '...here is an HTML with toolbar; nothing valuable to solve grouping problem...'
61.                }],
62.                "dataSource": {
63.                    "transport": {
64.                        "read": function (options) {
65.                            getOrders(options);
66.                        },
67.                    },
68.                    "schema": {
69.                        "groups": [{
70.                            "field": "number"
71.                        }],
72.                        "data": "data",
73.                        "total": "total"
74.                    },
75.                    "pageSize": 10,
76.                    "serverPaging": true,
77.                    "serverSorting": true,
78.                    "serverFiltering": true,
79.                    "serverGrouping": true, //why its not working?
80.                    "serverAggregates": true,
81.                    "error": XX.OrderGrid_Error
82.                }
83.            });


When I fire my application, I am trying drag'n'drop column header to "Drop column header here" box, but it seems like this functionality was disabled.

Maybe I am missing some section in kendoGrid constructor, or maybe I wrote some unnecessary data?
Michal
Top achievements
Rank 1
 answered on 17 Dec 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?