Forum


08:46

22/05/2009

Hi,
I have problem with displaing two grids on the same page.
first grid:
<table id="list2" class="scroll" cellpadding="0" cellspacing="0"></table>
<div id="pager2" class="scroll" style="text-align:center;"></div>
second grid:
<table id="list3" class="scroll" cellpadding="0" cellspacing="0"></table>
<div id="pager3" class="scroll" style="text-align:center;"></div>
definition for first grid:
jQuery(document).ready(function(){
var lastsel;
jQuery('#list2').jqGrid({
url:'<?php echo "$mosConfig_live_site"; ?>/components/com_tabs/tabela.php?nd='+new Date().getTime()+'&kat=<?php echo $_GET[kat]; ?>'+'&lang=<?php echo $_GET[lang]; ?>'+'&userid=<?php echo $userid; ?>',
datatype: "json",
colNames:['-','NDB_No','Name','B','C','D','E'],
colModel:[
{name:'act',index:'act', width:30,sortable:false, editable:false},
{name:'NDB_No',index:'NDB_No', width:55, editable:false},
{name:'Name',index:'name', width:600, editable:false},
{name:'B',index:'Nutr_Val', width:55, editable:false},
{name:'C',index:'tl', width:55, editable:false},
{name:'D',index:'weglo', width:55, editable:false},
{name:'E',index:'ener', width:55, editable:false}
],
pager: jQuery('#pager2'),
rowNum:10,
rowList:[10,20,30],
imgpath: 'themes/sand/images',
sortname: 'NDB_No',
mtype: "POST",
viewrecords: true,
sortorder: "asc",
loadComplete: function(){
var ids = jQuery('#list2').getDataIDs();
for(var i=0;i<ids.length;i++){
var cl = ids[i];
be = "<input style='height:16px;width:16px;' name='dodaj' type='image' SRC='<?php echo "$mosConfig_live_site"; ?>/images/dodatkowe/add.png' onclick='add_prompt("+cl+");' />";
jQuery('#list2').setRowData(ids[i],{act:be});
}
},
onSelectRow: function(id){
if(id && id!==lastsel){
jQuery('#list2').restoreRow(lastsel);
jQuery('#list2').editRow(id,true);
lastsel=id;
}
},
editurl: "<?php echo "$mosConfig_live_site"; ?>/components/com_tabs/tabela.php",
caption: "Produkty"
}).navGrid('#pager2',{add:false,del:false,edit:false,position:'right'});
})
definition for second grid:
jQuery(document).ready(function(){
var lastsel3;
jQuery('#list3').jqGrid({
url:'<?php echo "$mosConfig_live_site"; ?>/components/com_tabs/tabela_dod.php?nd='+new Date().getTime()+'&kat=<?php echo $_GET[kat]; ?>'+'&lang=<?php echo $_GET[lang]; ?>'+'&userid=<?php echo $userid; ?>',
datatype: "json",
colNames:['-','NDB_No','Name','B','C','D','E'],
colModel:[
{name:'act',index:'act', width:30,sortable:false, editable:false},
{name:'NDB_No',index:'NDB_No', width:55, editable:false},
{name:'Name',index:'name', width:600, editable:false},
{name:'B',index:'Nutr_Val', width:55, editable:false},
{name:'C',index:'tl', width:55, editable:false},
{name:'D',index:'weglo', width:55, editable:false},
{name:'E',index:'ener', width:55, editable:false}
],
pager: jQuery('#pager3'),
rowNum:10,
rowList:[10,20,30],
imgpath: 'themes/sand/images',
sortname: 'NDB_No',
mtype: "POST",
viewrecords: true,
sortorder: "asc",
loadComplete: function(){
var ids = jQuery('#list3').getDataIDs();
for(var i=0;i<ids.length;i++){
var cl = ids[i];
be = "<input style='height:16px;width:16px;' name='dd' type='image' SRC='<?php echo "$mosConfig_live_site"; ?>/images/dodatkowe/add.png' onclick='add_prompt("+cl+");' />";
jQuery('#list3').setRowData(ids[i],{act:be});
}
},
onSelectRow: function(id){
if(id && id!==lastsel){
jQuery('#list3').restoreRow(lastsel3);
jQuery('#list3').editRow(id,true);
lastsel3=id;
}
},
editurl: "<?php echo "$mosConfig_live_site"; ?>/components/com_tabs/tabela_dod.php",
caption: "Products"
}).navGrid('#pager3',{add:false,del:false,edit:false,position:'right'});
});
for now it should display the same data. I only want to see if it will show the second grid. Unfortunately it does not 🙁
It displays only one grid - if definition for the first grid is before the definition for 2nd it displays the first table and if definition for the 2nd grid is before the definition for 1st it displays the 2nd one.
Can you please tell me what am I missing?
Thx in advance
02:42

Moderators
30/10/2007

Hello,
Could you please try to use only one jQuery(document).ready(..
Instead of two?
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.
Most Users Ever Online: 715
Currently Online:
75 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