sEcho along with all jQueryDataTableParamModel parameters is null after 1st execution.
sEcho along with all jQueryDataTableParamModel parameters is null after 1st execution.
I have a jsp page with serverside processing having a form having some options(selection criteria for data to be displayed)and a button used to display a list data using datatable. For the first time, is display the list data on the page, but when i click for 2nd time changing date, then it gets stuck and the console says the all my params for datatable are null. the params are :
[code]
import javax.servlet.http.HttpServletRequest;
import com.healthslate.common.util.ObjectUtils;
public class DataTablesParamUtility {
public static JQueryDataTableParamModel getParam(HttpServletRequest request)
{
if(!ObjectUtils.isEmpty(request.getParameter("sEcho")))
{
JQueryDataTableParamModel param = new JQueryDataTableParamModel();
param.sEcho = request.getParameter("sEcho");
param.sSearch = request.getParameter("sSearch");
param.sSearch ="00:13:ef:60:0f:60";
param.sColumns = request.getParameter("sColumns");
param.iDisplayStart = Integer.parseInt(request.getParameter("iDisplayStart"));
param.iDisplayLength= Integer.parseInt(request.getParameter("iDisplayLength") );
param.iColumns = Integer.parseInt( request.getParameter("iColumns") );
param.iSortingCols = Integer.parseInt( request.getParameter("iSortingCols") );
param.iSortColumnIndex = Integer.parseInt(request.getParameter("iSortCol_0"));
param.sSortDirection = request.getParameter("sSortDir_0");
return param;
}else
return null;
}
}
[/code]
and my jsp page is :
[code]
<%@ page contentType="text/html; charset=ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="display" uri="http://displaytag.sf.net" %>
$(document).ready(function() {
if('${pageVisitLogList}' == 'undefined' || '${pageVisitLogList}' == '[]' || '${pageVisitLogList}' == ''){
$('.container').css('text-align', 'center');
}
var oTable= $('#row').dataTable(
{
"sDom" : "<'row'<'spanPag'l><'span6'p><'spanSer'f>r>t<'row'<'spanPage'i><'span6'p>>",
"oLanguage" : {"sLengthMenu" : "_MENU_ records per page"},
"bServerSide": true,
"sAjaxSource": "serverSideSearch.action?dateFrom="+$('#fromDate').val()+"&dateTo="+$('#toDate').val(),
"bProcessing": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "mDataProp": "deviceMacAddress" },
{ "mDataProp": "deviceName"},
{ "mDataProp": "facility"},
{ "mDataProp": "visitTime"},
{ "mDataProp": "module"},
{ "mDataProp": "pageVisited"},
]
});
$('#submitPageLog').click(function() {
alert('here we go');
oTable.fnReloadAjax("serverSideSearch.action?dateFrom="+$('#fromDate').val()+"&dateTo="+$('#toDate').val());
});
$("#fromDate").datepicker({
showOn: 'both',
buttonImage: "Reports/resources/images/calendar.gif",
buttonImageOnly: false,
changeMonth: false,
changeYear: false,
showAnim: 'slideDown',
duration: 'fast'
});
$("#toDate").datepicker({
showOn: 'both',
buttonImage: "Reports/resources/images/calendar.gif",
buttonImageOnly: false,
changeMonth: false,
changeYear: false,
showAnim: 'slideDown',
duration: 'fast'
});
$('.ui-datepicker-trigger').css('margin-bottom', '11px');
});
a {
color: #047CB9;
text-decoration: none;
}
Page Visit Report
Date From
Date To
Module
MAC Address
Facility
App Mode
Locale
MAC Address
Device Name
Facility
Visit Time
Module
Page Visited
[/code]
[code]
import javax.servlet.http.HttpServletRequest;
import com.healthslate.common.util.ObjectUtils;
public class DataTablesParamUtility {
public static JQueryDataTableParamModel getParam(HttpServletRequest request)
{
if(!ObjectUtils.isEmpty(request.getParameter("sEcho")))
{
JQueryDataTableParamModel param = new JQueryDataTableParamModel();
param.sEcho = request.getParameter("sEcho");
param.sSearch = request.getParameter("sSearch");
param.sSearch ="00:13:ef:60:0f:60";
param.sColumns = request.getParameter("sColumns");
param.iDisplayStart = Integer.parseInt(request.getParameter("iDisplayStart"));
param.iDisplayLength= Integer.parseInt(request.getParameter("iDisplayLength") );
param.iColumns = Integer.parseInt( request.getParameter("iColumns") );
param.iSortingCols = Integer.parseInt( request.getParameter("iSortingCols") );
param.iSortColumnIndex = Integer.parseInt(request.getParameter("iSortCol_0"));
param.sSortDirection = request.getParameter("sSortDir_0");
return param;
}else
return null;
}
}
[/code]
and my jsp page is :
[code]
<%@ page contentType="text/html; charset=ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="display" uri="http://displaytag.sf.net" %>
$(document).ready(function() {
if('${pageVisitLogList}' == 'undefined' || '${pageVisitLogList}' == '[]' || '${pageVisitLogList}' == ''){
$('.container').css('text-align', 'center');
}
var oTable= $('#row').dataTable(
{
"sDom" : "<'row'<'spanPag'l><'span6'p><'spanSer'f>r>t<'row'<'spanPage'i><'span6'p>>",
"oLanguage" : {"sLengthMenu" : "_MENU_ records per page"},
"bServerSide": true,
"sAjaxSource": "serverSideSearch.action?dateFrom="+$('#fromDate').val()+"&dateTo="+$('#toDate').val(),
"bProcessing": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "mDataProp": "deviceMacAddress" },
{ "mDataProp": "deviceName"},
{ "mDataProp": "facility"},
{ "mDataProp": "visitTime"},
{ "mDataProp": "module"},
{ "mDataProp": "pageVisited"},
]
});
$('#submitPageLog').click(function() {
alert('here we go');
oTable.fnReloadAjax("serverSideSearch.action?dateFrom="+$('#fromDate').val()+"&dateTo="+$('#toDate').val());
});
$("#fromDate").datepicker({
showOn: 'both',
buttonImage: "Reports/resources/images/calendar.gif",
buttonImageOnly: false,
changeMonth: false,
changeYear: false,
showAnim: 'slideDown',
duration: 'fast'
});
$("#toDate").datepicker({
showOn: 'both',
buttonImage: "Reports/resources/images/calendar.gif",
buttonImageOnly: false,
changeMonth: false,
changeYear: false,
showAnim: 'slideDown',
duration: 'fast'
});
$('.ui-datepicker-trigger').css('margin-bottom', '11px');
});
a {
color: #047CB9;
text-decoration: none;
}
Page Visit Report
Date From
Date To
Module
MAC Address
Facility
App Mode
Locale
MAC Address
Device Name
Facility
Visit Time
Module
Page Visited
[/code]
This discussion has been closed.
Replies