2013-02-26 138 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