1. extjs中checkcolumn怎么默认勾选部分checkbox
查看它对应的dataIndex名、在grid的store加载值时传个布尔值应该就行了
2. extjs 用Ext.grid.CheckColumn()时 为什么报 Cannot read property 'dataIndex' of undefined ext-all.js
请确认你的js文件使用的Ext的相关js文件导入成功。
发下你js代码片段
3. extjs grid 中 ColumnModel 小问题
1.可以不配置editor 项,来 单击单元格时便不自可编辑或者手动设置setEditable( Number col, Boolean editable ) 参数分别为行号与是否编辑。
2.正则不灵也许你没监听到那个事件,只能输入数字可以用Ext.form.NumberField 配置相关项可达到目的,只能输入正整数。
4. extjs GridPanel怎么添加ComboBox,TextField等form控件
就是用extjs键表格。。。用grid吧。。给你个例子
Ext.onReady(function(){
/**
*Handlerspecifiedforthe'Available'columnrenderer
*@param{Object}value
*/
functionformatDate(value){
returnvalue?value.dateFormat('Md,Y'):'';
}
//shorthandalias
varfm=Ext.form;
//
//
//thedatastore(createdbelow)
varcm=newExt.grid.ColumnModel({
//
defaults:{
sortable:true//
},
columns:[{
id:'common',
header:'CommonName',
dataIndex:'common',
width:220,
//useshorthandaliasdefinedabove
editor:newfm.TextField({
allowBlank:false
})
},{
header:'Light',
dataIndex:'light',
width:130,
editor:newfm.ComboBox({
typeAhead:true,
triggerAction:'all',
//
transform:'light',
lazyRender:true,
listClass:'x-combo-list-small'
})
},{
header:'Price',
dataIndex:'price',
width:70,
align:'right',
renderer:'usMoney',
editor:newfm.NumberField({
allowBlank:false,
allowNegative:false,
maxValue:100000
})
},{
header:'Available',
dataIndex:'availDate',
width:95,
renderer:formatDate,
editor:newfm.DateField({
format:'m/d/y',
minValue:'01/01/06',
disabledDays:[0,6],
disabledDaysText:''
})
},{
xtype:'checkcolumn',
header:'Indoor?',
dataIndex:'indoor',
width:55
}]
});
//createtheDataStore
varstore=newExt.data.Store({
//
autoDestroy:true,
//loadremotedatausingHTTP
url:'plants.xml',
//specifyaXmlReader()
reader:newExt.data.XmlReader({
//recordswillhavea'plant'tag
record:'plant',
//
fields:[
//the'name'belowmatchesthetagnametoread,except'availDate'
//whichismappedtothetag'availability'
{name:'common',type:'string'},
{name:'botanical',type:'string'},
{name:'light'},
{name:'price',type:'float'},
//
{name:'availDate',mapping:'availability',type:'date',dateFormat:'m/d/Y'},
{name:'indoor',type:'bool'}
]
}),
sortInfo:{field:'common',direction:'ASC'}
});
//createtheeditorgrid
vargrid=newExt.grid.EditorGridPanel({
store:store,
cm:cm,
renderTo:'editor-grid',
width:600,
height:300,
autoExpandColumn:'common',//
title:'EditPlants?',
frame:true,
clicksToEdit:1,
tbar:[{
text:'AddPlant',
handler:function(){
//'sstore
varPlant=grid.getStore().recordType;
varp=newPlant({
common:'NewPlant1',
light:'MostlyShade',
price:0,
availDate:(newDate()).clearTime(),
indoor:false
});
grid.stopEditing();
store.insert(0,p);
grid.startEditing(0,0);
}
}]
});
//
store.load({
//storeloadingisasynchronous,
callback:function(){
Ext.Msg.show({
title:'StoreLoadCallback',
msg:'storewasloaded,dataavailableforprocessing',
modal:false,
icon:Ext.Msg.INFO,
buttons:Ext.Msg.OK
});
}
});
});
5. Extjs new Ext.grid.CheckColumn的事件和用法
<ext:CheckColumn runat="server" Text="选择" ID="Selected" Selectable="true" Editable="true" Sealed="true" TplWriteMode="Append">
<DirectEvents>
<CheckChange OnEvent="Selected_ChangeEvent">
<ExtraParams>
<ext:Parameter Encode="true" Mode="Raw" Name="ID" Value="record.data.ID">
</ext:Parameter>
</ExtraParams>
</CheckChange>
</DirectEvents>
</ext:CheckColumn>
说实话这个控件真的很恶心,我找了好长时间才将他的后台事件找到,但是问题是怎么能让它选中呢?看网上的高手们说无法使用GridPanel本身的CheckColumn,要采用第三方扩展的控件实现,谁知道怎么让他呈现选中状态呢?期待大家的发现
6. Extjs怎么给Grid增加一个CheckBox列
首先导入扩展CheckColumn的JS文件在extjs文件包的/examples/ux/CheckColumn.js。 然后将你要用来显示true/false的那列的版xtype配置成checkcolumn。 例子: {xtype:"checkcolumn",header:"头部权",dataIndex:"xxxx"}