Telerik Forums
Kendo UI for jQuery Forum
1 answer
280 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
279 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
642 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
4 answers
174 views
When I add grid and dropdownlist control in page, I found the control size is bigger than your demo's. How come that? I attach my screenshot
Troy
Top achievements
Rank 1
 answered on 16 Dec 2013
1 answer
214 views
hey guys
I'm facing the following issue right now:

we use a grid which has a custom toolbar button which runs some function in the background. the code looks like this:

$("#CategorizeNow").click(function categorizing (e) {
        e.preventDefault();
 
        $.ajax({
            url: '@Url.Action("RunAutoCategorization", "Pattern")',
            beforeSend: function() {
                $("#CategorizeNow").addClass("k-state-disabled").html("Categorizing!");
            },
            success: function () {
 
                $("#CategorizeNow").removeClass("k-state-disabled").html("Finished");
                $("#CategorizeNow").kendoTooltip({
                    content: "successfully finished",
                    position: "top",
                    animation: {
                        close: {
                            effects: "fade:out"
                        },
                        open: {
                            effects: "fade:in",
                            duration: 1000
                        }
                    }
                }).show($("#CategorizeNow"));
                 
 
 
            }
 
        });
    });
what we want to achieve is: after the categorize button is clicked it should be disabled first. when the background operation succeeded, the tooltip should be displayed at the top of the categorize now button and the button should get its original state again and be enabled again.

right now the tooltip is only showing if the operation has finished and the mouse enters the button.

any advice would be helpful.

thx in advance and kind regards
thomas
Alexander Popov
Telerik team
 answered on 16 Dec 2013
4 answers
578 views
I`m binding data via Ajax to grid. I added Change event to the grid. what happening is code inside the Onchange event is executing twice .
I have ajax call inside the Change event function , how can I control this ?  My requirement is I should able to write an event that fires at row level like row select event.


 @(Html.Kendo().Grid<User>()
      .Name("grid")
      .DataSource(datasource => datasource
          .Ajax()
          .ServerOperation(false)
          .Model(model => model.Id(p => p.UserID))
          .Read(read => read.Action("AllUserRecords_Read", "User"))
          .PageSize(15)

      )
      .Columns(columns =>
      {
          columns.Bound(p => p.FirstName).Width(40);
          columns.Bound(p => p.LastName).Width(80);
          columns.Bound(p => p.EmailAddress).Width(70);
       })
      .Pageable(pageable => pageable.PreviousNext(true).PageSizes(new[] { 5, 10, 15, 20 }))
      .Filterable()
      .Events(events => events.DataBound("onDataBound").Change("grid_change"))
      .Selectable(select => select.Mode(GridSelectionMode.Single))
      .Resizable(resize => resize.Columns(true))
      .Reorderable(reorder => reorder.Columns(true)))

 function grid_change(e) {
            $.ajax({
                type: "POST",
                url: "/User/GetRoles",
                data: { userID: id },
                async: false,
                success: function (response) {
                    $("#roles").replaceWith(response);
                },
                error: function (response, q, t) {
                    alert(response.responseText);
                }
            });
 function onDataBound(arg) {
        this.element.find('tbody tr:first').addClass('k-state-selected');
}
}
Artsem
Top achievements
Rank 1
 answered on 16 Dec 2013
5 answers
156 views
In WPF RadControls you can pass a function call back to a RadWindow. Can you use a similar approach with Kendo modalView?

WPF Example

this.commandWindowClosing = new RelayCommand<CancelEventArgs>((args) =>
            {
                if (!_closing)
                {
                    args.Cancel = true;
                    RadWindow.Confirm(AppConstConfirmShutdown, this.RequestShutdown);
                }
            });
 
private void RequestShutdown(object sender, WindowClosedEventArgs e)
        {
            try
            {
 
                if (e.DialogResult == true)
                {
                            // Do something
                }
Sorry for posting C# :-)

Is this approach possible with Javascipt and modalView in am mobile app? the samples I've seen don't do this

I know you can override the close event but that doesn't help me, If Kendo implemented Confirm,Alert etc like RadWindow it would be very useful.
Kiril Nikolov
Telerik team
 answered on 16 Dec 2013
4 answers
249 views
I'm not sure if I'm doing something conceptually wrong, but I'd like to use a predefined model and fill it with data form a remote request through DataSource AND the same model inside a view for exposing it's data in HTML.

Right now, I'm doing something like that:
ModelUserProfile: kendo.data.Model.define({
 id: "userId"
,fields: {
 ,firstName: { type: "string" }
 ,lastName: { type: "string" }
        ...
}
});
 
var datasource = new kendo.data.DataSource({
       ...
      schema: {
            model: ModelUserProfile
      },
      ...
});
<div
    id="show-userprofile"
     data-role="view"
     data-model="ModelUserProfile"   
     data-layout
="default"
>
...
</div>
 
<script id="templateUserprofile" type="text/x-kendo-template">
...
   <div data-bind="visible: firstName">Vorname:</div>
...
</script>

As soon as I use the binding inside the view, I'm getting an "Uncaught TypeError: Cannot read property 'get' of undefined" from kendo.mobile.min.js.

Am I doing this wrong (or too complicated?).

As a work-around, I changed it to:
# if (firstName) { # <div>Vorname:</div> # } #
which works fine, but I'd prefer to bind it.

Thanks in advance for any help on this.


Roman
Top achievements
Rank 1
 answered on 16 Dec 2013
3 answers
391 views
I have a Kendo Grid with a column bounded to a enum.  All works fine except when it comes to sorting.  The sorting is performed on the int values of the items, instead of by the text.  i.e.

public enum Test{
    Red = 1,
    Yellow = 2
    Amber = 3
}

Sorting ascending, it outputs: Red, Yellow, Amber.  Instead of Amber, Red, Yellow.
Sorting descending it outputs: Amber, Yellow, Red.  Instead of Yellow, Red, Amber.

How can I get it to sort properly based on the text strings on the left?

Thx!

Mao
Alexander Popov
Telerik team
 answered on 16 Dec 2013
1 answer
48 views

New to Kendo and tablet/responsive development and am really lost trying to decide what widgets to use for the following.

Id like something to work like the dropdownlist in the mobile framework forms section except it would work like this.
Click on an initiator.
Depending on window size, slide over or just open something on the screen like the dropdown does.
Load and display a grid which has the potential to be very long. Allow the user to highlight more than one row which will act as selections so vertical scrolling will be required.
Hit a back or close and you are back to the same page where the initiator is.

I've found some widgets here and there while going through all the examples but didn't write them down and now I can't find them anymore.

thanks
Kiril Nikolov
Telerik team
 answered on 16 Dec 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?