I'm currently working with an MVC page where I'm using Grid.Mvc table. I also have some search fields where I can update the table via Ajax Post, once I use the search fields and submit for sorting the html gets replaced on post-back, once replaced, the grid rows can NOT be clicked like before the Ajax call, is like the ajax call is killing the javascript or Jquery or both,
我目前正在使用MVC页面,我正在使用Grid.Mvc表。我也有一些搜索字段,我可以通过Ajax Post更新表,一旦我使用搜索字段并提交排序html被替换后回复,一旦被替换,网格行不能像Ajax调用之前一样点击,就像ajax调用是杀死javascript或Jquery或两者,
here is code for the Ajax call for the grid:
这是网格的Ajax调用的代码:
$(function() {
$(document) on.("click", "#buscar", function() {
$.ajax({
url: '/MainPage/Grid',
type: 'POST',
async: false,
datatType: 'html',
processData: true,
data: {
url: $('#url').val(),
isInternal: ('#isInternal').val()
},
success: function(data) {
$('#grid').html(data);
}
})
});
});
Here is the code for when I click the rows I send another Ajax call, but after the first code post the grid becomes unclickable;
这是我单击我发送另一个Ajax调用的行时的代码,但在第一个代码发布后,网格变得无法点击;
$(function() {
pagesGrids.linksgrid.onRowSelect(function() {
$.ajax({
url: '/mainpage/getlinkdetails',
type: 'POST',
async: false,
dataType: 'html',
processData: true,
data: {
id: e.row.BrokenId
},
success: function(data) {
$('#linkdetails').html(data);
},
error: function() {
alert('something went wrong')
}
})
});
})
Any help or hint that can point me in the right direction will greatly appreciated, thanks
任何帮助或暗示可以指出我正确的方向将非常感谢,谢谢
UPDATE
The the grid it self is a partial view rendering at Index on MVC
它自己的网格是在MVC上的Index处呈现的局部视图
<div id="grid">
@Html.Action"Grid"
</div>
1 个解决方案
#1
0
Your partial view is rendering new elements into the page rather than altering the existing elements.
您的局部视图将新元素呈现到页面中,而不是更改现有元素。
You will need to rebind the javascript events (click) to the new elements after the partial postback.
在部分回发后,您需要将javascript事件(单击)重新绑定到新元素。
#1
0
Your partial view is rendering new elements into the page rather than altering the existing elements.
您的局部视图将新元素呈现到页面中,而不是更改现有元素。
You will need to rebind the javascript events (click) to the new elements after the partial postback.
在部分回发后,您需要将javascript事件(单击)重新绑定到新元素。