ExtJs 4.1.1复选框呈现为按钮,需要正常复选框
ExtJs 4.1.1 Checkbox is rendering as button, need normal check box
我使用的是ExtJs 4.1.1,希望在div中呈现普通复选框,但使用以下代码,它被呈现为按钮。我检查了Ext.form.field.Checkbox的ExtJs源代码,在其中发现了fieldSubTpl
属性的注释,该注释表示
// Creates not an actual checkbox, but a button which is given aria role="checkbox" (If ARIA is required) and
// styled with a custom checkbox image. This allows greater control and consistency in
// styling, and using a button allows it to gain focus and handle keyboard nav properly.
如果是这种情况,那么如何获得正常复选框?
Ext.create('Ext.container.Container',{
id: 'myContainer',
width: 100,
renderTo: 'chekboxId',
items: [{
xtype:'checkboxgroup',
id:'chekcboxGrpId',
items:[
{
boxLabel: 'Text check box',
name : 'MyCheckBox',
inputValue: 'true',
checked: true
}
]
}]
})
我认为问题在于您的项目中没有包含css/image这是的例子
css
<link rel="stylesheet" href="http://cdn.sencha.io/try/extjs/4.1.1/resources/css/ext-all-gray.css">
HTML
<div id="checkbox"></div>
Javascript
Ext.onReady(function(){
var panel = Ext.create('Ext.panel.Panel', {
items: {
xtype: 'fieldcontainer',
fieldLabel: 'Toppings',
defaultType: 'checkbox',
items: [
{
boxLabel : 'Anchovies',
name : 'topping',
inputValue: '1',
id : 'checkbox1'
}
]
}
});
panel.render('checkbox');
})
相关文章:
- 任何人都可以帮助我编写代码,以便在 extjs 4.2 的组合框中制作带有复选框的面板
- Extjs 复选框列:区分单击复选框和字段的其余部分
- 验证 ExtJS 复选框组复选框
- 在复选框状态ExtJS 4.1中手动检测与编程更改
- extjs 3.4使用combo store创建复选框组项目
- Extjs使用复选框模型在网格上拖放单个项目
- ExtJs 4.1.1复选框呈现为按钮,需要正常复选框
- ExtJS 2.3:复选框标签上的工具提示
- ExtJS-3,Ext.grid.GridPanel,多行复选框:如何一次提交所有选中的项目
- EXTJS 5:如何只有在点击网格中的复选框时才选中复选框
- 如何检查 extjs 中是否选中了复选框
- 选中“ExtjS”复选框时,才选择行
- 取消选中ExtJS Grid Filter复选框并不会删除过滤器
- 动态复选框,单选,checkboxgroups, radiogroups extjs
- ExtJs多选组合框与复选框列表
- 如何使只读复选框与extjs 4
- 如何在ExtJs 6.2中基于Store构建复选框组
- 动态创建复选框;在ExtJS中点击按钮不会被选中
- EXTJS复选框显示为[object object]
- ExtJS复选框主题更改