This is a migrated thread and some comments may be shown as answers.

Kendo UI grid not populating the data

2 Answers 192 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mathew
Top achievements
Rank 1
Mathew asked on 19 Feb 2013, 05:30 PM
I tried to bind a grid from the corresponding to the data entered in a textbox, but the grid is not populated
Also there is no error displayed
 This is the code i used

$("#txtSearchCaller").keyup(function () { SearchCaller($(this)); });

function SearchCaller(txtSearchCaller) {
            SearchRequestProcess = $.ajax({
            type: "GET",
            url: baseURL + "Call/SearchCaller",
            data: "term=" + $(txtSearchCaller).val(),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: OnGetCallerSuccess,
            error: function (request, status, error) { if (request.statusText != "abort") { alert("SearchCaller:: " + request.statusText); } }
                });
    }
}
function OnGetCallerSuccess(Jsondata, status) {
    $("#Grid").kendoGrid({ // create Grid from div HTML element Kendo
        dataSource: Jsondata,
        selectable: "row",
        scrollable: true,
        navigatable: true,
        resizable: true,
        groupable: false,
        columns: [
                    {
                        field: "category1",
                        title: "category1",
                        width: 80
                    },
                    {
                        field: "category2",
                        title: "Customer Name",
                        width: 80
                    },
                ]
    });
}

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 21 Feb 2013, 10:52 AM
Hello Mathew,

Your current approach will result in multiple initialization of the Grid widget which is not supported.
If you want to modify the Grid's data I recommend you to use the DataSource API methods such as data or filter.
The first one will let you to completely replace the existing data, while the second one will allow you to filter (search) specific records.

In other words, you can initialize the Grid with empty dataSource on document.ready and only change its data at the success event of the Ajax request.

In case this does not help. Please post a sample of the Json response that is received on the client so I can examine it and assist you further.
Thank you in advance.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mathew
Top achievements
Rank 1
answered on 21 Feb 2013, 11:31 AM
Thanks it works now with what u suggested
Tags
Grid
Asked by
Mathew
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Mathew
Top achievements
Rank 1
Share this question
or