2013-02-26 137 views

回答

0

你可以试试,(它应该工作),如果没有,发布您的代号。

$('#dg').datagrid({ 
    onSelect: function(rowIndex, rowData) 
    { 

     //your stuff 
    }, 
    onUnselect: function(rowIndex, rowData){ 

     //your stuff 
    }, 
    onUnselectAll: function(rows){ 

     //your stuff 
    } 
}); 

确保datagrid属性singleSelect =“true”。

+1

谢谢你,我写了这段代码,但它只是不能触发事件$('#manhour').datagrid({ singleSelect: true, url: "/manager_project/show/<%= @id %>", columns:[[ {field:'hours',title:'工数', width:50,editor:{ type: 'numberbox', options:{ precision:2 } } } ]], onSelect:function(rowIndex){ $('#manhour').datagrid('beginEdit', rowIndex); }, onUnselect:function(rowIndex){ $('#manhour').datagrid('endEdit', rowIndex); } }); kagen88 2013-02-26 09:18:52

+1

你发布的代码没有问题。但请检查代码所在的位置,即是否将代码放置在某些条件块(如果.. else ..)下。 – 2013-02-26 09:46:59