2014-11-05 69 views
0

道場需要一定的CSS字段其筆者認爲以下情況:我該如何讓我的CSS工作正常我的dojo dijit表單按鈕?

我的CSS:

.configButton .dijitButtonNode { 
    background-image: url(../images/gear16.png); 
    background-position: center center; 
    background-repeat: no-repeat; 
    width: 16px; 
    height: 16px; 
} 

我的結構部分:

    { id: 'config', field: 'config', name: 'Config', width: '61px', 
         widgetsInCell: true, 
         navigable: true, 
         allowEventBubble: true, 
         decorator: function(){ 
           //Generate cell widget template string 
           return [ 
             '<button data-dojo-type="dijit.form.Button" ', 
             'data-dojo-attach-point="btn3" ', 
             'class="configButton" ', 
             'data-dojo-props="onClick: function(){', 
               'alert(\'Configuration\');', 
             '}"></button>' 
           ].join(''); 
         }, 
         setCellValue: function(data){ 
           //"this" is the cell widget 
           this.btn3.set('label3', data); 
         } 
        } 

我不能讓我的按鈕才能正常工作,特別是圖標圖像。我的GridX單元格中只有一個摺疊按鈕。

回答

0

試試這個代碼:

setCellValue: function(gridData, storeData, cellWidget){ 
     cellWidget.btn3.set('label3', data); 
} 
0

當我在爲gridx電池使用小工具,我用的是onCellWidgetCreated方法:

{ 
 
    // ... 
 
    widgetsInCell: true, 
 
    onCellWidgetCreated: function(cellWidget, column) { 
 
    cellWidget.btn3 = new Button({ 
 
     class: 'configButton', 
 
     onClick: function() { 
 
     alert('Configuration'); 
 
     } 
 
    }); 
 
    cellWidget.btn3.placeAt(cellWidget.domNode); 
 
    }, 
 
    setCellValue: function(data, storeData, cellWidget) { 
 
    cellWidget.btn3.set('label3', data); 
 
    } 
 
}

+0

嗨,你有一個工作示例在Gridx單元格中使用小部件?我不知道爲什麼我的工作不正常:\我在這裏發佈了一個問題:[link](http://stackoverflow.com/questions/32149477/use-of-oncellwidgetcreated-in-dojo-gridx-to-add-按鈕 - 細胞) – gotcha 2015-08-22 06:55:42

相關問題