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

Repopulating grid fails

0 Answers 25 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marius
Top achievements
Rank 1
Marius asked on 23 Aug 2012, 12:13 PM
I'm using the following ajax request to refresh the grid, but I always get an empty grid. I'm not able to find what I'm doing wrong. 

$(document).ready(function () {
           $(document).on("click", ".ceva", getNextState);
       });
       function getNextState(e) {
           var grid = $("#Grid").data("kendoGrid");
           var ID = $(e.currentTarget).attr('id');
           var orderID = $(e.currentTarget).attr('data-ID');
           var urlCon = "Idea/NextState?state=" + ID + "&iD=" + orderID;
           $.ajax({
               type: "POST",
               url: urlCon,
               contentType: "application/json; charset=utf-8",
               success: function (data) {
                   var x = data;
                   grid.dataSource.data(data);
                   grid.refresh();
 
               },
               error: function () {
                   alert("something went wrong");
               }
           });

I'm trying to achieve a way to remove a row from the table after I trigger the NextState method for that row. Is there a better way to do that then refreshing the grid's data source? 
Thanks in advance. 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Marius
Top achievements
Rank 1
Share this question
or