I´ve edited data and rebound Telerik MVC Grid through Jquery. The things is that I need to access the "new" rows, or to rephrase, the rows that were generated after rebind process. For some reason my Jquery function reads the old data from the grid, the data before rebinding process.
<script type="text/javascript">
var categoryID;
var subCategoryID;
var categoryForSubCategoryId;
function onChangeSubCategories(e) {
var url = '/SubCategory/FindSubCategoryIdByName/';
$.ajax({
type: 'GET',
data: { name: e.value },
dataType: 'html',
url: url,
success: function(data) {
var ids = data.split('###');
subCategoryID = ids[0];
categoryID = ids[1];
var subCategoryGrid = $('#SubCategoryGrid').data('tGrid');
subCategoryGrid.rebind();
var productGrid = $('#ProductGrid').data('tGrid');
productGrid.rebind();
$('#CategoryGrid tr').each(function () {
var tr = this;
if (tr.cells[0].innerHTML == categoryID) {
$(this).toggleClass('t-state-selected');
}
else if ($(this).hasClass('t-state-selected')) {
$(this).toggleClass('t-state-selected');
}
});
$('#SubCategoryGrid tr').each(function () {
//TODO: every row here is the old data
var tr = this;
if (tr.cells[0].innerHTML == subCategoryID) {
$(this).toggleClass('t-state-selected');
}
else if ($(this).hasClass('t-state-selected')) {
$(this).toggleClass('t-state-selected');
}
});
}
});
}
</script>
Can anyone give me any pointers in how to access the rows from the grid after rebinding?