我能够使用以下方法将标题中的文本居中:
[colid="startstop"].gridxCell{
text-align: center;
}
我认为这会将属于 startstop 列的所有行单元格居中,但事实并非如此。我的 startstop 列在每一行中包含一个按钮。我还有另外两列就像这样。如何在我选择的三列中将按钮居中?
这是我的结构的一部分:
{ id: 'startstop', field: 'startstop', name: 'Start/Stop', 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="btn" ',
'class="startStopButton" ',
'data-dojo-props= ',
'"onClick: function(){',
'alert(\'Start/Stop\');',
'}"><img src="images/1413390026_control.png" /></button>'
].join('');
},
setCellValue: function(data){
//"this" is the cell widget
this.btn.set('label', data);
}
},
这是我的 css 类——它现在只做按钮的大小,因为我在让它自己工作时遇到了其他麻烦——但这是另一个问题。
.startStopButton .dijitButtonNode {
width: 16px;
height: 16px;
text-align: center;
}