【问题标题】:How do I get my css to work correclty for my dojo dijit form button?如何让我的 css 为我的 dojo dijit 表单按钮正常工作?
【发布时间】:2014-11-05 19:55:55
【问题描述】:

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 单元格中只有一个折叠按钮。

【问题讨论】:

    标签: css dojo dijit.form dojo.gridx


    【解决方案1】:

    试试这个代码:

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

    【讨论】:

      【解决方案2】:

      当我在 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);
        }
      }

      【讨论】:

      • 嗨,您有在 Gridx 单元格中使用小部件的工作示例吗?我不知道为什么我的不工作:\我在这里发布了一个问题:link
      猜你喜欢
      • 2014-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-31
      • 2015-06-14
      • 2014-06-12
      • 2012-10-02
      • 1970-01-01
      相关资源
      最近更新 更多