Telerik Forums
Kendo UI for jQuery Forum
6 answers
565 views
Hi,

When adding rows to the grid and pressing "Create" a json package are sent to the server.

Thats fine,- but what about the server response,- how/where is it handled by the grid?

Serverside I validate for duplicates and want to tell the grid when the create did fail(or was a success) - how is this trivial task implemented?

1. Light up rows that are not valid
2. Alert the user

Been searching the forum/documentation - with no success.
Erlend
Top achievements
Rank 2
 answered on 27 Apr 2012
3 answers
1.3K+ views

Hi,
My issue is simple, I have a normal HTML Dropdown List or <select> list. I am using the following code to convert it to Kendo Drop Down

$(document).ready(function () {
            $(".mySelect").kendoDropDownList();

 }

It works, but the alignment is not good. When I open the dropdown list to choose the Items, the list is a little bit moved to the right of the base-button. 

Here is the screenshot

Click Here For Screenshot
Iliana Dyankova
Telerik team
 answered on 27 Apr 2012
4 answers
473 views
I would love to see an example of a grid bound to a viewmodel. When the user selects a row in the grid the details of the row are shown below the grid in input fields. If you edit one of the fields the grid will automatically update. Have anyone done anything like this? Can you please create a jsfiddle demonstrating it for me? I have not been able to find something like this, but I belive it is a very common thing to do.
Bjarke
Top achievements
Rank 1
 answered on 27 Apr 2012
1 answer
396 views
I'm evaluating this product for my organization and to be honest I'm very new to this stuff. I've been playing around with stuff for a couple of days but I appear to have become stuck on something pretty trivial.

I'm calling an ASP.NET web service using VS 2010. I'm calling it from the dataSource, and then binding the dataSource to the chart. It works fine when I don't try to pass parameters, I get the results into the chart and everything seems right. The Kendo definition of the datasource is

                    var dsprov = new kendo.data.DataSource({
                        schema: {
                            data: "d"
                        },
                        transport: {
                            read: {
                                url: "IndustryTrends.aspx/ChartData",
                                contentType: "application/json; charset=utf-8", // tells the web service to serialize JSON
                                type: "POST"
                            }
                        }
                    });


And the definition of the web service is

<WebMethod()>
    Public Shared Function ChartData() As IEnumerable(Of BolIndustryChartDataItem)
        Dim c As New List(Of BolIndustryChartDataItem)
        c.Add(New BolIndustryChartDataItem("My name", 3,4,5))
        Return c
    End Function



...this all works fine.

But now I want to add a parameter to the read function in order to be able to read the correct data. I assumed that all I had to do was change the dataSource definition to:

   var dsprov = new kendo.data.DataSource({
                        schema: {
                            data: "d"
                        },
                        transport: {
                            read: {
                                url: "IndustryTrends.aspx/ChartData",
                                contentType: "application/json; charset=utf-8", // tells the web service to serialize JSON
                                type: "POST",
data: { 
name: function() {
return "michael";
} }


                            }
                        }
                    });

....and then change the web service to 

<WebMethod()>
    Public Shared Function ChartData(byval name as string) As IEnumerable(Of BolIndustryChartDataItem)
        Dim c As New List(Of BolIndustryChartDataItem)
        c.Add(New BolIndustryChartDataItem("My name", 3,4,5))
        Return c
    End Function


....but this causes the web service to never get called. I know I missing something trivial here but I'e spend some time looking at it, tried a bunch of different things, and I can't figure out what.

Thanks!
Vivek
Top achievements
Rank 1
 answered on 27 Apr 2012
1 answer
77 views
Is there a way to turn off a widget once it has been applied?

So if I have a case like: 

$(this).kendoGrid(...)

I need to turn it off for a certain case. Is that possible?

Dimo
Telerik team
 answered on 27 Apr 2012
0 answers
98 views
Hi, I'm new to kendo and I downloaded kendo web and found no upload example on the examples/index.html.  Where can I find it please?  Thanks.

Update: Got it working, though still didn't see it as part of the examples folder.  Thanks.
ray
Top achievements
Rank 1
 asked on 26 Apr 2012
6 answers
304 views
Hello,

I'm currently trying to create a variable that will be used as a grid DataSource.  When I create a typeless variable, this is working perfectly.... however, if I cast my variable as a kendo.data.DataSource, the grid doesn't work anymore.

Here's my code:
var myDataSource = {
    schema: {
        model: {
            id: "RecordID",
            fields: {
                RecordID: { editable: false, nullable: true },
                FirstName: { editable: true },
                LastName: { editable: true }
            }
        }
    },
    type: "odata",
    serverPaging: true,
    serverSorting: true,
    pageSize: 100,
    batch: false,
    transport: {
        read: "http://localhost:1625/Data/GetPatients",
        create: { url: "http://localhost:1625/Data/Create", contentType: "application/json; charset=utf-8", type: "POST" },
        update: { url: "http://localhost:1625/Data/Update", contentType: "application/json; charset=utf-8", type: "POST" },
        destroy: { url: "http://localhost:1625/Data/Destroy", contentType: "application/json; charset=utf-8", type: "POST", dataType: "json" },
        parameterMap: function (data, operation) {
            if (operation !== "read") {
                return kendo.stringify(data);
            } else {
                return kendo.data.transports["odata"].parameterMap(data, operation);
            }
        }
 
    }
 
 
};
 
var myDataSource2 = new kendo.data.DataSource({
    schema: {
        model: {
            id: "RecordID",
            fields: {
                RecordID: { editable: false, nullable: true },
                FirstName: { editable: true },
                LastName: { editable: true }
            }
        }
    },
    type: "odata",
    serverPaging: true,
    serverSorting: true,
    pageSize: 100,
    batch: false,
    transport: {
        read: "http://localhost:1625/Data/GetPatients",
        create: { url: "http://localhost:1625/Data/Create", contentType: "application/json; charset=utf-8", type: "POST" },
        update: { url: "http://localhost:1625/Data/Update", contentType: "application/json; charset=utf-8", type: "POST" },
        destroy: { url: "http://localhost:1625/Data/Destroy", contentType: "application/json; charset=utf-8", type: "POST", dataType: "json" },
        parameterMap: function (data, operation) {
            if (operation !== "read") {
                return kendo.stringify(data);
            } else {
                return kendo.data.transports["odata"].parameterMap(data, operation);
            }
        }
 
    }
 
 
});
 
$(document).ready(function () {
    $("#grid").kendoGrid({
        dataSource: myDataSource, //This is working but if you change it to myDataSource2, then it doesn't work
        height: 500,
        scrollable: {
            virtual: true
        },
        editable: true,
        sortable: true,
        toolbar: ["create", "save"],
        columns: ["RecordID", "FirstName", "LastName", { command: "destroy"}]
    });
});

As mentionned in the code, myDataSource is working but not myDataSource2.

Am I missing something here?

Best regards,

Simon



Simon
Top achievements
Rank 1
 answered on 26 Apr 2012
5 answers
289 views

$("#shortList").kendoGrid({

            height: 400,

            columns: [{

                field: "name",

                title: "Name"

            }],

            dataSource: {

                data: [

                    {

                        name: "Test"

                    }]

            }

        });


then I get this exception when trying to add a row using API later:
TypeError: 'undefined' is not an object (evaluating 'this._set.indexOf')


$("#shortList").data("kendoGrid").addRow();

Using the latest commercial version of your software.  How do I add a row using API?

Joshua
Top achievements
Rank 1
 answered on 26 Apr 2012
1 answer
100 views
Hello,

I have a grid that when an item is selected, it changes an image based on the selected data item.

The code firing on the change event is as follows:

function showSelectedImage() {
 
                    var grid = $("#grid").data("kendoGrid");
 
                    //var data = grid.dataItem(grid.select());
 
                    grid.select().each(function () {
                        var data = grid.dataItem($(this));
                        if (null != data) {
                            $("#documentPreview").attr("src", data.ImageUrl);
                            $("#documentPreview").attr("alt", data.DocumentId);
 
                            $("#documentView").attr("src", data.ImageUrl);
                            $("#documentView").attr("alt", data.DocumentId);
 
 
 
                            $("#openImageHyperLink").attr("href", data.ImageUrl);
 
 
                            if ($("#documentPreview").is(":hidden")) {
                                $('#documentPreview').slideDown("slow", "easein", null);
 
                            }
 
                            if (null != data.ExtraPageUrls) {
                                buildPager(data.ExtraPageUrls);
                            }
                        }
                    });
 
                     
                }

This code works fine on an un-grouped grid.  However, when grouping is enabled, when you click an item in the second group, the data item return is the next one in the list, rather than the current one.  If you click the preceding group footer, you get the data item for the first item in the next group.

It is as if the group footer is bound to a data item, messing up the sequence......

E.G:

SUPPLIER NAME GROUP HEADER
DATA 1
DATA 2
SUPPLIER NAME GROUP FOOTER
DATA 3
DATA 4

-----

Clicking Data 3 row returns DATA 4 data item.

Clicking SUPPLIER NAME GROUP FOOTER returns DATA 3 Data Item

HELP!!!!!
Rosen
Telerik team
 answered on 26 Apr 2012
2 answers
85 views
I am using a grid that has inline editing enabled. If it Edit the grid, but then hit cancel instead of update, it caused the row to be removed.

I have reproduced this in the following JSFiddle: http://jsfiddle.net/sFaUp/1/ 
If you hit edit, then cancel, the row gets removed.

This seems like a bug to me, however its possible I have something configured incorrectly. Could I receive some help with this?

Thanks!
Kyle
Top achievements
Rank 1
 answered on 26 Apr 2012
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?