DataTable in JSP using Servlet
DataTable in JSP using Servlet
chandrakant2511
Posts: 2Questions: 1Answers: 0
Hi All,
I am working on Web Application, which follows only index.jsp and inside this file I have mentioned
In reports.jsp, I am going to select One link which give me customized data in 3 column: phonebook, name, number and which is call from report.js file.
From report.js, I have called,
function getreport(dtype,userId,appId,campId)
{
$('#StatusDetail_list').hide();
$('#StatusDetail_list').empty();
$('#StatusDetail_report').hide();
$('#StatusDetail_report').empty();
var params={command:'getCampaignStatusDetail_TypeWise',rptType:dtype,creator_id:userId,camp_appId:appId,camp_Id:campId};
//alert(userId+' '+appId);
$.ajax({
data : params,url : "transaction.do",
success : function(data) {
var items = "";
var error = [];
var iserr = true;
$.each(data, function(key, val) {
if(key=='aaData'){
iserr = false;
$.each(val, function(key, v) {
alert(v.fname);
items+=(''+v.phbookname+''+v.fname+''+v.contactnumber+'');
});
}
if(iserr == true){
if(key=='message'){
error.push('Error!!!');
//alert("Detail not found");
}
}
});
if(iserr == true){
$('', {
'class' : 'my-new-list',
html : error.join('')
}).appendTo('#users_Result');
}else{
//items+=('');
alert('here2');
$('#tblExample').html(items);
$('#tblExample').dataTable({
"bServerSide": true,
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"aoColumns": [
{ "mDataProp": "contactnumber" },
{ "mDataProp": "phbookname" },
{ "mDataProp": "phbookname" },
]
});
}
}
});
}
I have mentioned table with ID=tblExample in report.jsp
<!-- -->
Name
Number
Book
I am received data on table, but not in dataTable format.
Help me out..
Thanks in advance.
Chandrakant
I am working on Web Application, which follows only index.jsp and inside this file I have mentioned
In reports.jsp, I am going to select One link which give me customized data in 3 column: phonebook, name, number and which is call from report.js file.
From report.js, I have called,
function getreport(dtype,userId,appId,campId)
{
$('#StatusDetail_list').hide();
$('#StatusDetail_list').empty();
$('#StatusDetail_report').hide();
$('#StatusDetail_report').empty();
var params={command:'getCampaignStatusDetail_TypeWise',rptType:dtype,creator_id:userId,camp_appId:appId,camp_Id:campId};
//alert(userId+' '+appId);
$.ajax({
data : params,url : "transaction.do",
success : function(data) {
var items = "";
var error = [];
var iserr = true;
$.each(data, function(key, val) {
if(key=='aaData'){
iserr = false;
$.each(val, function(key, v) {
alert(v.fname);
items+=(''+v.phbookname+''+v.fname+''+v.contactnumber+'');
});
}
if(iserr == true){
if(key=='message'){
error.push('Error!!!');
//alert("Detail not found");
}
}
});
if(iserr == true){
$('', {
'class' : 'my-new-list',
html : error.join('')
}).appendTo('#users_Result');
}else{
//items+=('');
alert('here2');
$('#tblExample').html(items);
$('#tblExample').dataTable({
"bServerSide": true,
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"aoColumns": [
{ "mDataProp": "contactnumber" },
{ "mDataProp": "phbookname" },
{ "mDataProp": "phbookname" },
]
});
}
}
});
}
I have mentioned table with ID=tblExample in report.jsp
<!-- -->
Name
Number
Book
I am received data on table, but not in dataTable format.
Help me out..
Thanks in advance.
Chandrakant
This discussion has been closed.