Telerik Forums
Kendo UI for jQuery Forum
4 answers
140 views
Hi,

I am using Datagrid and would like to add the error handle function. Follow the doc from Kendo and I change the code as below in sample project. But the error always fired no matter with error or not. Can support team help? Many thanks, George

@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.OrderViewModel>()    
    .Name("grid")
    .Columns(columns => {
        columns.Bound(p => p.OrderID).Filterable(false).Width(100);
        columns.Bound(p => p.Freight).Width(100);
        columns.Bound(p => p.OrderDate).Format("{0:MM/dd/yyyy}").Width(140);
        columns.Bound(p => p.ShipName);
        columns.Bound(p => p.ShipCity).Width(150);
    })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Read(read => read.Action("Orders_Read", "Grid"))
        .Events(events => events.Error("alert('errorAlert')"))
     )
)



public ActionResult Orders_Read([DataSourceRequest]DataSourceRequest request)
        {
            return Json(GetOrders().ToDataSourceResult(request));
        }
Daniel
Telerik team
 answered on 18 Jun 2013
1 answer
88 views
Hello! I have a problem with binding MVVM objects to action parameters.

When I have on client side in viewmodel array of observable objects (for example (pseudocode) array TestArray: 0 {Id: 3, Name: 'qwe', State: 2}, 1 {Id: 5, Name: 'rty', State: 3}) and I post this from popup window (grid editing), on server side I get such form values: TestArray[0][Id], TestArray[0][Name], TestArray[0][State], TestArray[1][Id], TestArray[1][Name], TestArray[1][State]
But I expect to get: TestArray[0].Id, TestArray[0].Name etc., becouse I want MVC to bind this data to IEnumerable of custom type (public int Id, public string Name, public int State).

Can you give me advise how to solve this problem, thank tou
Daniel
Telerik team
 answered on 18 Jun 2013
2 answers
313 views
I have a VM has a DataSource in it.

var layerTable = new kendo.data.DataSource();
When new data arrives, I am able to populate the LayerTable with the data() function. But I also want to dynamically add in aggragates to this.

1.vm.SetLayers = function(values) {
2.    this.LayerTable.data(values);
3.    this.LayerTable.aggregate = [{ field: "FileCount", aggregate: "count" }];
4.    //this.trigger("change", { field: "LayerTable" });
5.};
I am finding that when I later try to get the aggregates() I get an empty object.

1.vm.LayerTable.aggregates();

Dr.YSG
Top achievements
Rank 2
 answered on 18 Jun 2013
1 answer
51 views
It took me a full day to realize it was the way Kendo was perceiving the data and not something I was doing, to come to the conclusion that Pie charts will not display properly if the data handed to it is in a string format, however all other charts are fine. I've been working on a dashboard and passing all data to the browser in the same manner until I tried drawing pie charts. This is more of a "in-case anyone comes across this issue" or even something for the Telerik team to put in as a fix, but I made a jsbin example to demonstrate the problem

http://jsbin.com/anezec/2/edit

I'm just curious as to why the lines have no problem display but the pie charts do?
Hristo Germanov
Telerik team
 answered on 18 Jun 2013
2 answers
2.7K+ views
Hello,

I'm working on implementing a stacked bar chart solution with one vertical column, but would like to increase the width of this vertical bar to fill the entire chart container it resides in (see screenshot).  Is there a way to increase just the width of this bar?

This is my JS:

function createChart() {
                    $("#chart").kendoChart({
chartArea: {
background:"#f3f3f3",
margin:0,
padding:0
},

                      legend: {
                            visible: false,

},
                        seriesDefaults: {
                            type: "column",
stack: true,
width:90
},

series: [{
name: "Interest",
                            stack: "Mortgage",
                            data: [494.50],
color: "#f58025",
width:90
                        }, {
                            name: "Taxes",
                            stack: "Mortgage",
                            data: [375],
color: "#f58025"
                        }, {
                            name: "Principle",
                            stack: "Mortgage",
                            data: [269],
color: "#f58025"
                        }, {
                            name: "PMI",
                            stack: "Mortgage",
                            data: [200],
color: "#f58025"
                        }, {
                            name: "Rollover",
                            stack: "Mortgage",
                            data: [75],
color: "#f58025"
                      
                         }, {
                            name: "Insurance",
                            stack: "Mortgage",
                            data: [50],
color: "#f58025"
}],
                        valueAxis: {
color:"#ff0000",
max:1450,

labels:{
color:"",
visible:false
},
line: {
                                visible: false
                            },
majorGridLines: {
                                visible: false
                            },

                        },
                        categoryAxis: {
color:"",
justified:true,
categories: ["Ex"],
width:2,
                            

majorGridLines: {
                                visible: false
                            },
crosshair: {
 width: 2,
 visible: true
},
},
                        tooltip: {
                            visible: true,
                            template: "#= series.name #: #= ['$']+value #"
                        }
                    });
                }



Thank you!
Randy
Top achievements
Rank 1
 answered on 18 Jun 2013
7 answers
581 views
Hi,

I have been using kendo treeview to display Menu.
Below is my tree view
$("#treeview").kendoTreeView({
                template: '# if(item.isOvr) { # <b>#=item.txt#</b># } else { ##=item.txt## }#',
                select: function (e) {
                    if (this.dataItem(e.node) != null) {
                        this.expand(e.node);
                    }
                },
                dataSource: inlineDefault
            });

var inlineDefault = new kendo.data.HierarchicalDataSource({
                transport: {
                    read: {
                        cache: false,
                        url: "/menu/GetTree",
                        dataType: "json",
                        data: { 'id': $('#menuId').val(), 'netId': $('#networkId').val(), 'breakcache': new Date().getTime() }
                    }
                },
                schema: {
                    model: {
                        id: "id",
                        children: "Items",
                    }
                }
            });

Each Item have following properties:

var item = {
                id: id,
                actualid: actaulId,
                typ: menutype,
                prnt: parent,
                txt: text,
                isOvr: isOverride
            };

How Can I update all the properties of a single node? 
or refresh all the children from database of particular node.
Daniel
Telerik team
 answered on 18 Jun 2013
3 answers
381 views
I have a kendo grid for user managment when I go  to edit a user fields that are nullable byte keep on saying that the fields are required if i don't select a value for them.

Here is my view code for these and model.

<div class="phoneNumberEntry">
                    <div class="phoneModalDropdown">@Html.DropDownListFor(model => Model.Phone1.PhoneTypeId, ViewBag.PhoneTypeList1 as SelectList, new { @style = "width: 105px" })</div>
                    <span class="phoneNumber">@Html.EditorFor(model => Model.Phone1.PhoneNumber)</span>
                    <span class="extension">@Html.EditorFor(model => Model.Phone1.PhoneExtension)</span>
                    <span class="isPrimary">Primary: <input type="checkbox" data-bind="checked: Phone1.IsPhonePrimary"/></span>
                </div>
 
                <div class="phoneNumberEntry">
                    <div class="phoneModalDropdown">@Html.DropDownListFor(m => m.Phone2.PhoneTypeId, ViewBag.PhoneTypeList2 as SelectList, "Select Type", new { @style = "width: 105px" })</div>
                    <span class="phoneNumber">@Html.EditorFor(model => Model.Phone2.PhoneNumber)</span>
                    <span class="extension">@Html.EditorFor(model => Model.Phone2.PhoneExtension)</span>
                    <span class="isPrimary">Primary: <input type="checkbox" data-bind="checked: Phone2.IsPhonePrimary"/></span>
                </div>
 
                <div class="phoneNumberEntry">
                    <div class="phoneModalDropdown">@Html.DropDownListFor(m => m.Phone3.PhoneTypeId, ViewBag.PhoneTypeList3 as SelectList, "Select Type", new { @style = "width: 105px" })</div>
                    <span class="phoneNumber">@Html.EditorFor(model => Model.Phone3.PhoneNumber)</span>
                    <span class="extension">@Html.EditorFor(model => Model.Phone3.PhoneExtension)</span>
                    <span class="isPrimary">Primary: <input type="checkbox" data-bind="checked: Phone3.IsPhonePrimary"/></span>
                </div>
 
public class PhoneType
    {
        public string PhoneTypeDesc
        { get; set; }
        public byte? PhoneTypeId
        { get; set; }
    }
Petur Subev
Telerik team
 answered on 18 Jun 2013
1 answer
29 views
Hi,

I have a
drag and drop treeview and on the drop event I would like to verify if we are
droping over a node. If we do, force the node to drop after that node?

The result
would then be: When people drop an element on another element it would just
appear under the node and not as it's child.

 

Thank you

Petur Subev
Telerik team
 answered on 18 Jun 2013
1 answer
1.2K+ views
Hello,

I have 9 DropDownListFor that cascades from other DropDownList. I need to disable validation for DropDownLists that has no items. How to do it ?
Alexander Valchev
Telerik team
 answered on 18 Jun 2013
1 answer
40 views
An example line from my code:

$("#action-results-grid").data("kendoGrid").setDataSource(myDataSource);

How can I find a reference for the '.data("widget")' function, I have searched everywhere.

The examples clearly display how this function is used, but not once was it introduced in the tutorial documentation with a summary of it's functionality and why it is used.

My naive guess is that it returns an object wrapping the HTML element to provide methods associated with the widget, but still I would love to see a reference for this function to better understand how/when to use it and precisely what it does.

I can not find a reference to it in the API documentation.

Cheers,
Ross

Atanas Korchev
Telerik team
 answered on 18 Jun 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?