jqGrid主网格问题
我有一个主网格,想要显示详细网格中主网格的行单击结果。 我无法获取详细网格上的数据...
$(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},
{name:'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?
我可以只提取数据而不是从服务器获取所有数据从第一个网格中选择行...
此外,我有一个按钮调用释放案例选择并单击该按钮,我已将选定的行发送到数据库...我有一个操作类,但我必须如何发送选定的行。
jQuery("#relCasePick").click( function(){
var id = jQuery("#list10").jqGrid('getGridParam','selarrrow');
alert(id);
});
我可以做类似 jQuery(("#list10").jqGrid('getGridParam','action class URL')
我可以做这样的事情将行发送到服务器吗
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);
}
});
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},
{name:'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);
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您当前的代码中,您为详细网格设置了 url,就像
您想要的那样,
您是否也可以重新表述您的第二个问题
“获取下一个网格的值”是什么意思?下一个网格是细节网格吗?您想从哪里获取值?关于
getRowData
方法(请参阅 http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods#grid_lated_methods)您可以从主网格的选定行获取完整数据,但是您计划从哪个来源获取详细网格的数据?In your current code you set url for the detail grid like
do you want probably have
Could you also reformulate your second question
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?