I have a datepicker and on selecting the date and clicking button it should display the grid beneath it ...
my approach:
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("#datepicker").datepicker({
showOn:'button',
buttonImage: '../../image/icon_cal.png',
buttonImageOnly:true
});
jQuery(".submit").click(function(){
var btnClick = jQuery("#businessError").jqGrid('setGridParam',
{url:"/cpsb/cPSBBusinessErrors.do?method=getBusinessErrors"});
});
jQuery("#businessError").jqGrid({
sortable:true,
url: '/cpsb/cPSBBusinessErrors.do?method=getBusinessErrors',
datatype:'json',
colNames:['Error Number','Error Message','Created date','Created User',
'Last Modified Date','Last Modified User'],
colModel:[
{ name:'errorNumber',index:'errorNumber', width:80, sorttype:"int",
align:"center", key:true },
{ name:'errorMessage',index:'errorMessage', width:280,
sorttype:"text", align:"center" },
{ name:'createdDate',index:'createdDate', width:180,
sorttype:"text", align:"center" },
{ name:'createdUser',index:'createdUser', width:180,
sorttype:"text", align:"center" },
{ name:'lastModifiedDate',index:'lastModifiedDate',
width:180, sorttype:"text", align:"center" },
{ name:'lastModifiedUser',index:'lastModifiedUser',
width:180, sorttype:"text", align:"center" },
],
rowNum:10,
rowList:[10,20,30],
jsonReader : {repeatitems: false,
root: function(obj) {
return obj;
},
page: function (obj) { return 1; },
total: function (obj) { return 1; },
records: function (obj) { return obj.length; }
},
pager: '#businessErrorpager',
sortname: 'SKU',
sortorder: "desc",
loadonce:true,
viewrecords: true,
caption: "Business Errors"
});
jQuery("#businessError").jqGrid('navGrid',
{view:true,add:false,edit:false,del:false});
});
//]]>
</script>
html markup:
<div id="header"><jsp:include page="../menu_v1.jsp"/></div>
<div id="mainContent">
<div id="business_form">
<form class="dateform" id="date" method="post"
action="/businessError.do?method=getBusinessErrors">
<fieldset class="ui-widget ui-widget-content ui-corner-all">
<legend class="ui-widget ui-widget-header ui-corner-all">Business Error</legend>
<p>
<label for="spogname">Select Date:</label>
<input type="text" id="datepicker"/>
</p>
<p>
<button class="submit" type="submit">Submit</button>
</p>
</fieldset>
</form>
<div class="business">
<table id="businessError"><tr><td></td></tr></table>
<div id="businessErrorpager"></div>
</div>
</div>
</div>