发送其他参数editurl在jqGrid的 [英] Sending additional parameters to editurl on JQgrid
问题描述
我现在的问题是试图发送ID(编辑:假
)编辑这一行,当一排。
例如,我有柱用户ID(编辑:假
)的网格,用户名(编辑:真正的
),名字(编辑:真正的
),姓氏(编辑:真正的
)。当编辑该行的网格只发送参数的用户名,名字和姓氏。在服务器端,我需要的用户ID来知道我哪个用户屠应用这些新值。
在editUrl如下:
editurl:CONTEXT_PATH +'?/ AJAX /管理/ savePart.do类= 1',
感谢
这是全code:
$ jgrid.useJSON = TRUE。
//http://www.trirand.com/jqgridwiki/doku.php?id=wiki%3Acommon_rules
$(文件)。就绪(函数(){
//警报(CONTEXT_PATH);
VAR lastsel;
jQuery的(#rowed3)。jqGrid的(
{
网址:CONTEXT_PATH +'/ AJAX / getPartesByCategory.do CATID =< S:属性值=的categoryId/>',
// URL:/autoWEB/text.html,
数据类型:JSON,
ajaxGridOptions:{的contentType:应用/ JSON的},
jsonReader:{
根:行,
页:页,
总:总,
记载:记录,
repeatitems:假的
},
headertitles:真正的,
colNames:['ID','Pieza','Disponible'],
colModel:[{
名称:piezaId,
索引:piezaId,
对齐:权,
宽度:50,
编辑:假的,
要求:真实的
},{
名称:descripcion,
索引:descripcion,
宽度:390,
编辑:真正的,
要求:真实的
},{
名称:disponible,
索引:disponible,
宽度:80,
编辑:真正的,
edittype:'选择',
editoptions:{值:0:无; 1:思},
要求:真实的
}],
的rowNum:20,
rowList:[20,40,60,80],
寻呼机:#prowed3,
sortname:piezaId,
POSTDATA:{piezaId:lastsel},
MTYPE:POST,
viewrecords:真正的,
排序顺序:递减,
onSelectRow:功能(ID){
如果(ID&安培;&安培;!ID == lastsel){
jQuery的('#rowed3)jqGrid的('restoreRow',lastsel)。
jQuery的('#rowed3)jqGrid的('editRow,ID,真实)。
lastsel = ID;
}
},
editurl:CONTEXT_PATH +'/ AJAX /管理/ savePieza.do categoria =< S:属性值=的categoryId/>',
标题:Piezas
});
jQuery的(#rowed3)。jqGrid的('navGrid',#prowed3,{
编辑:假的,
地址:假的,
德尔:假的
});
})
您可以使用
隐藏:真正的,可编辑:真正的,editrules:{edithidden:假},hidedlg:真
在 piezaId
(ID)列的定义。参数 hidedlg
目前还没有真正需要的,但如果你决定使用其他jqGrid的功能将非常有用。
My problem now is trying to send the ID (editable: false
) of a row when editing that row.
For example, i have a grid with columns userid(editable: false
), username(editable: true
), firstname(editable: true
), lastname(editable: true
). When editing the row the grid is only sending the parameters username, firstname and lastname. In the server side i need the userid to know to which user i've tu apply those new values.
the editUrl looks like:
editurl : CONTEXT_PATH+'/ajax/admin/savePart.do?category=1',
Thanks
This is the full code:
$.jgrid.useJSON = true;
//http://www.trirand.com/jqgridwiki/doku.php?id=wiki%3Acommon_rules
$(document).ready(function() {
//alert(CONTEXT_PATH);
var lastsel;
jQuery("#rowed3").jqGrid(
{
url : CONTEXT_PATH+'/ajax/getPartesByCategory.do?catid=<s:property value="categoryId" />',
//url : '/autoWEB/text.html',
datatype: "json",
ajaxGridOptions: { contentType: "application/json" },
jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false
},
headertitles: true,
colNames : [ 'ID', 'Pieza', 'Disponible'],
colModel : [ {
name : 'piezaId',
index : 'piezaId',
align : "right",
width : 50,
editable : false,
required : true
}, {
name : 'descripcion',
index : 'descripcion',
width : 390,
editable : true,
required : true
}, {
name : 'disponible',
index : 'disponible',
width : 80,
editable : true,
edittype : 'select',
editoptions:{value:"0:No;1:Si"},
required : true
} ],
rowNum : 20,
rowList : [ 20, 40, 60, 80 ],
pager : '#prowed3',
sortname : 'piezaId',
postData: {piezaId : lastsel},
mtype:"POST",
viewrecords : true,
sortorder : "desc",
onSelectRow : function(id) {
if (id && id !== lastsel) {
jQuery('#rowed3').jqGrid('restoreRow', lastsel);
jQuery('#rowed3').jqGrid('editRow', id, true);
lastsel = id;
}
},
editurl : CONTEXT_PATH+'/ajax/admin/savePieza.do?categoria=<s:property value="categoryId" />',
caption : "Piezas"
});
jQuery("#rowed3").jqGrid('navGrid', "#prowed3", {
edit : false,
add : false,
del : false
});
})
You can use
hidden: true, editable: true, editrules: { edithidden: false }, hidedlg: true
in the definition of the piezaId
(ID) column. The parameter hidedlg
is currently not real needed, but can be useful if you decide the use other jqGrid features.
这篇关于发送其他参数editurl在jqGrid的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!