我想通过dgrid / editor更改我插入OnDemandGrid的小部件的宽度。模板文件通过调用this.ruleLinesColumns()
来设置列,该<div data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region: 'center', gutters: false">
<div data-dojo-type="dgrid/OnDemandGrid"
data-dojo-mixins="dgrid/Selection, dgrid/extensions/DijitRegistry, prophet/common/dgrid/_StandardGridMixin, prophet/common/dgrid/_TreeRowHighlightingMixin"
data-dojo-attach-point="ruleLinesGrid"
data-dojo-props="'class': 'grid',
store: this.ruleLinesStore,
columns: this.ruleLinesColumns(),
sort: 'sequence',
selectionMode: 'single',
deselectOnRefresh: false">
</div>
</div>
返回函数返回的列。我通过以下代码将dgrid / editor插件添加到列中。默认情况下,窗口小部件的宽度设置为比列宽宽得多。我想将它设置为100%,以便它适合列而不是过去。
以下是我的文件:
模板文件
ruleLinesColumns: function() {
var self = this;
return [
...
editor({
field: "training",
label: msgs.editor.training,
sortable: false,
required: true,
autoSave: true
}, NumberTextBox),
...
];
},
我设置列的位置
style: {width: '100%'}
我尝试了几个不同的内容,例如包括width: '100%'
和{{1}},但似乎没有任何效果。
这里是dgrid / editor的文档: https://github.com/SitePen/dgrid/blob/master/doc/components/mixins/Editor.md
答案 0 :(得分:0)
我能找到答案!
因为列小部件是通过dgrid / editor传入的,所以实际上可以包含为editorArgs
内的NumberTextBox设置的所有内容。
例如,我必须让小部件的宽度为100%,并确保NumberTextBox只能输入正整数,同时使其需要强>:
editor({
field: "training",
label: msgs.editor.training,
sortable: false,
autoSave: true,
editorArgs: {
required: true, // Since required isn't part of editor's field, I had to put it into editorArgs as well
constraints: {min: 0, places: 0},
style: {width: '100%'}
}
}, NumberTextBox),