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"}