partial view grid event initialization

May 24, 2014 at 12:39 AM
I am rendering a partial view through an ajax call. The partial view contains a grid. I have placed the onRowSelect event registration in my ajax callback function but my code breaks because it doesn't recognize my grid. Is there a way to do this?

MyPartialViewGrid not recognized following successful ajax call and render
to target div.
function (result, textStatus, responseStatus) {        
         pageGrids.MyPartialViewGrid.onRowSelect(function (e) {
         alert(e.row.MyColumn);
         return false;
   });           
});
Coordinator
May 31, 2014 at 4:01 PM
Hi,

You need to initialize your grid, using
 $(".grid-mvc").gridmvc();
After page loads, gridmvc.js automatically do this, if you render grid after ajax request - you need to do this manually.
Nov 27, 2014 at 10:05 AM
Hi,

I'm trying to do this in my ajax call here but I get a runtime error saying "Object doesn't support property or method 'gridmvc'".

When I browse through the available methods on my grid object I can call $('FundGrid').init(); but then my pageGrids collection is still empty.

Any thoughts on where I'm going wrong?

Thanks