2013-01-11 55 views
0

我使用的jqGrid顯示的數據,我需要「點擊這裏來編輯」中的所有細胞和「點擊此處刪除」爲刪除按鈕電池顯示工具提示電網

這表明這種最好的方式jqgrid中的工具提示?

是否有可能與

colNames: ['ROLEID', "Name", "", ""], 
colModel: [ 
    { name: 'ROLEID', index: 'ROLEID', width: 10, hidden: true, key: true }, 
    { name: 'ROLENAME', index: 'ROLENAME', width: 50, editable: true, 
     search: false}, 
    { name: '', index: '', search: false, width: 30, align: "center", 
     formatter: function (cellvalue, options, rowObject) { 
      var btnDelete = 
       '<div class="round-icon-btn close right delete_step" id=btnId_' + 
       options.rowId + ' ></div>'; 
      return btnDelete; 
     }}, 

回答

2

可以使用cellattr屬性設置自定義列工具提示上添加:

{ name: 'mydelete', search: false, width: 30, align: "center", 
    cellattr: function() { return ' title="Click here to delete"'; }, 
    formatter: function (cellvalue, options, rowObject) { 
     var btnDelete = 
      '<div class="round-icon-btn close right delete_step" id=btnId_' + 
      options.rowId + ' ></div>'; 
     return btnDelete; 
    }} 

此外我不認爲在自定義按鈕上設置id屬性是非常必要的。要處理點擊自定義按鈕,您可以使用onCellSelectbeforeSelectRow回調。參見the answer,this one,this old one

+0

它工作,非常感謝 –

+0

@UllasMathew:歡迎您! – Oleg