如何通过参数EditOptions DataURL方法edittype ="选取[对于内联编辑 [英] How to pass parameter to EditOptions DataURL method for edittype="select" for inline editing
问题描述
我需要不同的设定值中的jqGrid一个下拉列。我使用的的jqGrid 4.4.4
I need to get different set of values in a dropdown column in jqGrid. I am using jqGrid 4.4.4
有问题的两个部分
- 如何将参数传递给我的DataURL的方法?
- How to pass a parameter to my DataURL method?
列模型
{ key: false, name: 'ContactName', index: 'ContactName', editable: true, width: '100px', sortable: false, frozen: true, formatter: 'select', edittype: 'select',
editoptions: {
dataUrl: '/InvestorList/GetContactList'
}
和2 如何填充值的单元格时,它是不是在编辑模式?我使用内联编辑。
And 2. How to populate the value in the cell when it is not in Editing mode? I am using inline editing.
谢谢,
推荐答案
如果您使用的不是你有限制的可能性这么老的版本,但我看起来jqGrid的4.4.4的code。它已经一个特点,你可以使用:可以使用 POSTDATA
定义函数:
If you use so old version than you have restricted possibilities, but I looks in the code of jqGrid 4.4.4. It have already one feature which you can use: you can use postData
defined as function:
{ name: 'ContactName', editable: true, width: 100, sortable: false, frozen: true,
formatter: 'select', edittype: 'select',
editoptions: {
dataUrl: '/InvestorList/GetContactList',
postData: function (rowid, value, cmName) {
return {
myId: rowid
}
}
}
}
我在联系人姓名
不需要首页
属性的定义中删除和固定的价值从错误值宽度
属性'100px的
到 100
。该值应为数字
I removed in the definition of ContactName
unneeded index
property and fixed the value of width
property from wrong value '100px'
to 100
. The value should be a number.
以上code与ROWID为请求添加 MYID
参数/ InvestorList / GetContactList
The above code add myId
parameter with rowid to the request to '/InvestorList/GetContactList'
.
要设置单元格的值,如果该行不内联/单元格编辑模式下,可以只使用的 setCell 方法
To set the value of the cell, if the row is not in the inline/cell editing mode, you can use just setCell method.
这篇关于如何通过参数EditOptions DataURL方法edittype ="选取[对于内联编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!