nfServerData not called ?
nfServerData not called ?
poutchyouk
Posts: 17Questions: 0Answers: 0
Hi,
I'm sorry but I can't link to my page.
I'm trying to do like in this tuto (part 3) http://www.codeproject.com/Articles/177335/Refreshing-content-of-the-table-using-AJAX-in-ASP
Where the he shows who to do a master-slave datatable in mvc3.
tuto code =>
[code]
$(document).ready(function () {
/* Initialize master table - optionally */
var oCompaniesTable = $('#companies').dataTable({ "bJQueryUI": true });
/* Highlight selected row - optionally */
$("#companies tbody").click(function (event) {
$(oCompaniesTable.fnSettings().aoData).each(function () {
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});
var MasterRecordID = null;
var oEmployeesTable = $('#employees').dataTable({
"sScrollY": "100px",
"bJQueryUI": true,
"bServerSide": true,
"sAjaxSource": "MasterDetailsAjaxHandler",
"bProcessing": true,
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name": "CompanyID", "value": MasterRecordID });
$.getJSON(sSource, aoData, function (json) {
fnCallback(json)
});
}
});
$(".masterlink").click(function (e) {
MasterRecordID = $(this).attr("id");
oEmployeesTable.fnDraw();
});
});
[/code]
But when I try it in my project, the fnDraw function do not call the fnServerData function.
Is there a reason why ?
Note: when my table is initilized, the fnServerData function is called correctly.
Arrg it's really a pain that I can't link to my page (>.<')
Thanks for reading and for any help :)
I'm sorry but I can't link to my page.
I'm trying to do like in this tuto (part 3) http://www.codeproject.com/Articles/177335/Refreshing-content-of-the-table-using-AJAX-in-ASP
Where the he shows who to do a master-slave datatable in mvc3.
tuto code =>
[code]
$(document).ready(function () {
/* Initialize master table - optionally */
var oCompaniesTable = $('#companies').dataTable({ "bJQueryUI": true });
/* Highlight selected row - optionally */
$("#companies tbody").click(function (event) {
$(oCompaniesTable.fnSettings().aoData).each(function () {
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});
var MasterRecordID = null;
var oEmployeesTable = $('#employees').dataTable({
"sScrollY": "100px",
"bJQueryUI": true,
"bServerSide": true,
"sAjaxSource": "MasterDetailsAjaxHandler",
"bProcessing": true,
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name": "CompanyID", "value": MasterRecordID });
$.getJSON(sSource, aoData, function (json) {
fnCallback(json)
});
}
});
$(".masterlink").click(function (e) {
MasterRecordID = $(this).attr("id");
oEmployeesTable.fnDraw();
});
});
[/code]
But when I try it in my project, the fnDraw function do not call the fnServerData function.
Is there a reason why ?
Note: when my table is initilized, the fnServerData function is called correctly.
Arrg it's really a pain that I can't link to my page (>.<')
Thanks for reading and for any help :)
This discussion has been closed.