2013-09-23 34 views
0

我有一個包含多個列的表單,其中一個是複選框,它發送兩個表單提交,然後單擊該複選框本身並導致數據庫鎖定。複選框(dojox.grid.cells.Bool)提交兩次

的index.jsp:

var gridLayout = [ 
    ... 
    {name:"Recurring", field:"isRecurring", type: dojox.grid.cells.Bool, width: "50px",editable:true} 
    ... 
] 

var grid = new dojox.grid.DataGrid({ 
    id: 'grid', 
    store: myStore , 
    structure: gridLayout 
}); 

dojo.connect(grid, 'onApplyCellEdit', function (a,index,c) { submit(index) }); 

是否有到 'onApplyCellEdit' 的方法嗎?

回答

1

今天我得到了同樣的問題。道場的

官方迴應:

DojoX中網格和EnhancedGrid被棄用,取而代之的dgrid和 是gridx。您應該升級您的代碼以使用這兩個網格中的一個。我們 將考慮修補舊的DojoX網格代碼。

有關解決方法,請參閱THIS。我沒有嘗試過。

1

user1189762說的是真實的,但我認爲還有另一種解決方法。

可以使用所述格式化您的佈局

 var layout = [[ 
         { 'name': 'Column 1', 'field': 'id', hidden: true }, 
         { 'name': 'Name', 'field': 'name', 'width': '200px' }, 
//This is the formatter for the Checkboix attribute so it can be in the middle in the start or wherever you need it 
         { 'name': 'Delete Mapping', 'field': '_item', 'width': '175px', formatter: checkBoxFormatter }, 
         { 'name': 'Note', 'field': 'note', hidden: true }, 
         { 'name': 'mappings', 'field': 'mappingelements', hidden: true } 
        ]]; 






function checkBoxFormatter(value, rowIndex) 
    { 
    var checkBox = new CheckBox({    
       checked: false, 
       onChange: function(b){ 
//The value is whatever you want the two parameter value and rowindex will get the row value or the row index 
        submit(value) 
          } 
      }); 
    } 

這應該工作。