Как мне заставить мой CSS работать корректно для моей кнопки формы dojo dijit?

dojo требует определенных полей css, которые, я считаю, следующие:

Мой 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.


person DemiSheep    schedule 05.11.2014    source источник


Ответы (2)


Попробуйте этот код:

setCellValue: function(gridData, storeData, cellWidget){
       cellWidget.btn3.set('label3', data);
}
person Ferry Kranenburg    schedule 05.11.2014

Когда я использую виджеты в ячейках 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);
  }
}

person Elad    schedule 06.11.2014
comment
Привет, у вас есть рабочий пример использования виджета в ячейке Gridx? Понятия не имею, почему мой не работает: \ Я разместил здесь вопрос: ссылка - person gotcha; 22.08.2015