Forum



15:25

12/02/2010

Howdy,
Somebody have any idea why the nav button is messed up in this jgrid on ui-tabs, for some reason the supposedly Receipt button on nav grid should display on each grid on each tab but as you can see on the image the nav button(Receipt) is located on "Daily Sales" tab grid twice, and it's not showing on "Monthly Sales" grid/tab.
Here the html:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DT.....t;>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>[% template.title %]</title>
<link rel="stylesheet" type="text/css" media="screen" href="[% c.uri_for('/static/css/custom-theme/jquery-ui-1.7.2.custom.css') %]" />
<link rel="stylesheet" type="text/css" media="screen" href="[% c.uri_for('/static/css/ui.jqgrid.css') %]" />
<script type="text/javascript" src="[% c.uri_for('/static/js/jquery-1.3.2.min.js') %]">
</script>
<script type="text/javascript" src="[% c.uri_for('/static/js/jquery-ui-1.7.2.custom.min.js') %]">
</script>
<script type="text/javascript" src="[% c.uri_for('/static/js/i18n/grid.locale-en.js') %]">
</script>
<script type="text/javascript" src="[% c.uri_for('/static/js/jquery.jqGrid.min.js') %]">
</script>
<script type="text/javascript" src="[% c.uri_for('/static/js/rep/monthly.js') %]"> </script>
<script type="text/javascript" src="[% c.uri_for('/static/js/rep/weekly.js') %]"> </script>
<script type="text/javascript" src="[% c.uri_for('/static/js/rep/daily.js') %]"> </script>
</head>
<body>
<div id="menu">
<ul>
<li><a href="#monthly">Monthly Sales</a></li>
<li><a href="#weekly">Weekly Sales</a></li>
<li><a href="#daily">Daily Sales</a></li>
</ul>
<div id="monthly">
<table id="monthlygrid" cellpadding="0" cellspacing="0">
</table>
<div id="pager2" class="scroll" style="text-align: center;"> </div>
</div>
<div id="weekly">
<table id="weeklygrid" cellpadding="0" cellspacing="0">
</table>
<div id="pager2" class="scroll" style="text-align: center;"> </div>
</div>
<div id="daily">
<table id="dailygrid" cellpadding="0" cellspacing="0">
</table>
<div id="pager2" class="scroll" style="text-align: center;"> </div>
</div>
</div>
</body>
</html>
And the relevant portion of the grid:
jQuery("#monthlygrid").jqGrid({
url:'/report/list',
datatype: "json",
colNames:['Product Code','Description','Discount %',
'Qty','Customer','Purchase Date','Consign Date',
'Due Date','In Cash','Consignment',],
pager: '#pager2',
sortname: 'product_id',
viewrecords: true,
sortorder: "asc",
width: 950,
height: "100%",
userDataOnFooter: true,
footerrow: 'true',
gridview:true,
caption:"" });
jQuery("#monthlygrid").jqGrid('navGrid','#pager2',
{add:false,addtext:'Add',del:false,deltext:'Delete',edit:false,edittext: 'Edit',search:false,refresh:false},
editOptions, // Edit Button handler
addOptions, // Add Button handler
delOptions, // Delete Button handler
{}).jqGrid('navButtonAdd',"#pager2",{caption:"Receipt",title:"Create Receipt",onClickButton:function () {
var postData = $("#monthlygrid").jqGrid('getGridParam','postData');
var str='';
for(i in postData)
str+=i+"="+postData[i]+"&";
window.location.href=( "/order/list?export=receipt&"+ str + new Date().getTime());
}});
//Tabs
$("#menu").tabs({remote:true});
});
Thanks in advance,
lupin
18:05

Moderators
30/10/2007

HEllo,
Please check if the both grids have the same pager id.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
22:49

12/02/2010

Hi Tony,
Yes, it does have some pager id since I just copied the grid definition as follow, pasted only the relevant portion:
<!-------------------- #dailygrid definition-------------------------------------------->
rowNum:100,
rowList:[100,200],
rownumbers:true,
pager: '#pager2',
sortname: 'product_id',
viewrecords: true,
sortorder: "asc",
width: 950,
height: "100%",
// toolbar: [true,"top"],
userDataOnFooter: true,
footerrow: 'true',
gridview:true,
//userData: "userdata",
caption:"" });
jQuery("#dailygrid").jqGrid('navGrid','#pager2',
{add:false,addtext:'Add',del:false,deltext:'Delete',edit:false,edittext: 'Edit',search:false,refresh:false},
editOptions, // Edit Button handler
addOptions, // Add Button handler
delOptions, // Delete Button handler
{}).jqGrid('navButtonAdd',"#pager2",{caption:"Receipt",title:"Create Receipt",onClickButton:function () {
var postData = $("#dailygrid").jqGrid('getGridParam','postData');
var str='';
for(i in postData)
str+=i+"="+postData[i]+"&";
window.location.href=( "/order/list?export=receipt&"+ str + new Date().getTime());
}});
//Tabs
$("#menu").tabs({remote:true});
});
<!-------------------#monthlygrid definition ---------------------------------------->
rowNum:100,
rowList:[100,200],
rownumbers:true,
pager: '#pager2',
sortname: 'product_id',
viewrecords: true,
sortorder: "asc",
width: 950,
height: "100%",
// toolbar: [true,"top"],
userDataOnFooter: true,
footerrow: 'true',
gridview:true,
//userData: "userdata",
caption:"" });
jQuery("#monthlygrid").jqGrid('navGrid','#pager2',
{add:false,addtext:'Add',del:false,deltext:'Delete',edit:false,edittext: 'Edit',search:false,refresh:false},
editOptions, // Edit Button handler
addOptions, // Add Button handler
delOptions, // Delete Button handler
{}).jqGrid('navButtonAdd',"#pager2",{caption:"Receipt",title:"Create Receipt",onClickButton:function () {
var postData = $("#monthlygrid").jqGrid('getGridParam','postData');
var str='';
for(i in postData)
str+=i+"="+postData[i]+"&";
window.location.href=( "/order/list?export=receipt&"+ str + new Date().getTime());
}});
//Tabs
$("#menu").tabs({remote:true});
});
here's, the generated html based on firebug, as you can see it created 2 pager2 div under the #dailygrid.
01:03

10/08/2009

Hi,
look one more time in your HTML code
<table id="monthlygrid" cellpadding="0" cellspacing="0">
</table>
<div id="pager2" class="scroll" style="text-align: center;"> </div>
</div>
<div id="weekly">
<table id="weeklygrid" cellpadding="0" cellspacing="0">
</table>
<div id="pager2" class="scroll" style="text-align: center;"> </div>
</div>
<div id="daily">
<table id="dailygrid" cellpadding="0" cellspacing="0">
</table>
<div id="pager2" class="scroll" style="text-align: center;"> </div>
</div>
HTML not permit to use the same id more then once on one page. So your current HTML code ir wrong. If you copy a code you have to make some minimal modifications in the copy. At least you have to rename two from three ids used as the pager.
Regards
Oleg
Most Users Ever Online: 715
Currently Online:
66 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66