jqgrid将keydown事件绑定到cell
当选择一个单元格时,我有一个像这样的网格
jQuery("#champDetail").jqGrid({
data: {},
height: 300,
width: 800,
colNames: ['ID', 'Combination No', 'Qty', 'SMT Program', 'SMT Machine',
'Product Date', 'Tracking No'],
colModel: [{ name: 'ID', width: 50 },
{ name: 'CombinationNo', width: 120, sortable: false },
{ name: 'QTY', width: 80, sortable: false, editable: true,
editrules: { custom: true, custom_func: QTYCheck} },
{ name: 'SMTProg', width: 120, sortable: false, editable: true },
{ name: 'SMTMach', width: 120, sortable: false, editable: true },
{ name: 'ProductDate', width: 120, sortable: false, editable: true },
{ name: 'TrackingNo', width: 100, sortable: false, editable: true }
],……………..
onCellSelect: function(rowid, colid) {
debugger;
if (colid == 3) {
var cm = jQuery("#champDetail").getRowData(rowid)
var temp = cm["QTY"]
$("#temp").keydown(function() {
alert("")
});
}
},……………………………..
,我想将 keydown 事件绑定到该单元格,
但我无法触发该事件。
这里有什么问题吗?
I have a grid like this
jQuery("#champDetail").jqGrid({
data: {},
height: 300,
width: 800,
colNames: ['ID', 'Combination No', 'Qty', 'SMT Program', 'SMT Machine',
'Product Date', 'Tracking No'],
colModel: [{ name: 'ID', width: 50 },
{ name: 'CombinationNo', width: 120, sortable: false },
{ name: 'QTY', width: 80, sortable: false, editable: true,
editrules: { custom: true, custom_func: QTYCheck} },
{ name: 'SMTProg', width: 120, sortable: false, editable: true },
{ name: 'SMTMach', width: 120, sortable: false, editable: true },
{ name: 'ProductDate', width: 120, sortable: false, editable: true },
{ name: 'TrackingNo', width: 100, sortable: false, editable: true }
],……………..
onCellSelect: function(rowid, colid) {
debugger;
if (colid == 3) {
var cm = jQuery("#champDetail").getRowData(rowid)
var temp = cm["QTY"]
$("#temp").keydown(function() {
alert("")
});
}
},……………………………..
when select a cell,i want to bind a keydown event to the cell ,
but i can't trigger the event.
what is the problem here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有 dataEvents
editoptions
可用于定义colModel
。它允许进行一些您需要的绑定,例如keydown
。searchoptions
也存在相同的选项。您可以在我的There are dataEvents
editoptions
which can be used to the definition of thecolModel
. It allows to make some bindings likekeydown
which you need.The same option exist also for the
searchoptions
. You can see the corresponding example in my old answer.试试这个:
Try this: