jqgrid将keydown事件绑定到单元格

时间:2010-12-01 09:00:19

标签: events jqgrid cell keydown

我有这样的网格

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事件绑定到单元格,

但是我无法触发事件。

这里有什么问题?

2 个答案:

答案 0 :(得分:1)

dataEvents editoptions可用于定义colModel。它允许制作一些你需要的keydown绑定。

searchoptions也存在相同的选项。您可以在我的old answer中看到相应的示例。

答案 1 :(得分:0)

试试这个:

$("#temp").keydown();
相关问题