I have a master grid and want to display the results on row click from master grid in detail grid.. I am not able to fetch the data on my detail grid ....
$(document).ready(function(){
{ $("#navmenu-v li").hover(
function() {
$(this).addClass("iehover"); },
function() {
$(this).removeClass("iehover");
} );
jQuery("#list10").jqGrid({
sortable:true,
url: '/cpsb/json/jsonpageheader.txt',
datatype:'json',
colNames:['Order','Load', 'Gate Time', 'Stop','Customer','Status'],
colModel:[
{
name:'orderNumber',
index:'orderNumber',
width:130,
align:"center",
sorttype:"int"
},
{
name:'loadNumber',
index:'loadNumber',
width:100, align:"center",
sorttype:"int"
},
{
name:'latestTime',
index:'latestTime',
width:160,
align:"center"
},
{
name:'stopSeq',
index:'stopSeq',
width:80,
align:"center",
sorttype:"int"
},
{
name:'customerNumber',
index:'customerNumber',
width:100,align:"center",
sorttype:"int"
},
{
name:'orderStatus',
index:'orderStatus',
width:80, 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: '#pager10',
sortname: 'Gate Time',
sortorder: "desc",
viewrecords: true,
multiselect: true,
caption: "Order Header",
onSelectRow: function(ids) {
if(ids == null) {
ids=0;
if(jQuery("#list10_d").jqGrid('getGridParam','records') >0 )
{
jQuery("#list10_d").jqGrid('setGridParam',{url:"/cpsb/unprocessedOrders.do?method=getUnprocessedOrderDetails"+ids,page:1});
jQuery("#list10_d").jqGrid('setCaption',"Order Header: "+ids).trigger('reloadGrid'); }
}
else {
jQuery("#list10_d").jqGrid('setGridParam',{url:"/cpsb/unprocessedOrders.do?method=getUnprocessedOrderDetails"+ids,page:1});
jQuery("#list10_d").jqGrid('setCaption',"Order Details: "+ids).trigger('reloadGrid');
}
} ,
height:'100%'
});
jQuery("#list10").jqGrid('navGrid','#pager10',{excel:true, add:false,edit:false,del:false,searchtext:"Filter"},{},{},{},{multipleSearch:true});
$("#list10").jqGrid('hideCol', 'cb');
jQuery("#relCasePick").click( function(){
var id = jQuery("#list10").jqGrid('getGridParam','selarrrow');
alert(id);
});
jQuery("#list10_d").jqGrid({
height: 100,
url:'/cpsb/unprocessedOrders.do?method=getUnprocessedOrderDetails',
datatype: "json",
colNames:['Order','SKU', 'UPC', 'Item Description','Quantity Ordered','Teach in Hold?'],
colModel:[ {name:'Order',index:'', width:55},
{n开发者_运维百科ame:'SKU',index:'sku', width:55},
{name:'UPC',index:'qty', width:40, align:"right"},
{name:'Item Description',index:'unit', width:150, align:"right"},
{name:'Quantity Ordered',index:'quantity', width:150,align:"right", sortable:false, search:false},
{name:'Teach in Hold?',index:'teachInId', width:150, align:"right"}, ],
rowNum:5,
rowList:[5,10,20],
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: '#pager10_d',
sortname: 'SKU',
viewrecords: true,
sortorder: "asc",
multiselect: true,
caption:"Order Detail"
}).navGrid('#pager10_d',{add:false,edit:false,del:false}, {},{},{},{multipleSearch:true});
jQuery("#ms1").click( function() {
var s;
s = jQuery("#list10_d").jqGrid('getGridParam','selarrrow');
alert(s); });
}});
is there a way that i will not pull the other grid data and instead of that only on row click from 1st grid i will get the values for next grid
Yes next grid is detail grid... what is basically do is to fetch the corresponding values for order number from master grid and display it in detail ....
for second part
is there a way that i will not pull the other grid data and instead of that only on row click from 1st grid i will get the values for next grid?
Instead of getting all the data from server can I just pull the data only on selecting the row from first grid...
Moreover, I have a button call release to case pick and clicking on that button I have send the selected rows to database....I hav ea action class for that but how I have to send that selected rows.
jQuery("#relCasePick").click( function(){
var id = jQuery("#list10").jqGrid('getGridParam','selarrrow');
alert(id);
});
can i do something like jQuery(("#list10").jqGrid('getGridParam','action class URL')
can I do something like this for sending the rows to server
jQuery("#relCasePick").click( function(){
var rows= jQuery("#list10").jqGrid('getRowData');
var paras=new Array();
for(var i=0;i<rows.length;i++){
var row=rows[i];
paras.push($.param(row));
}
$.ajax({
type: "POST",
url: "/cpsb/unprocessedOrders.do?method=releaseToCasePick",
data: paras.join('and'),
success: function(msg){
alert(msg);
}
});
In your current code you set url for the detail grid like
"/cpsb/unprocessedOrders.do?method=getUnprocessedOrderDetails"+ids
do you want probably have
"/cpsb/unprocessedOrders.do?method=getUnprocessedOrderDetails&someParameter="+ids
Could you also reformulate your second question
is there a way that i will not pull the other grid data and instead of that only on row click from 1st grid i will get the values for next grid?
What do you mean under "to get the values for next grid"? Is next grid is detail grid? From where you want to get the values? With respect of getRowData
method (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods#grid_related_methods) you can get full data from the selected row of the master grid, but from which source you plan to get data for the detail grid?
精彩评论