PDA

View Full Version : TypeError: Cls is not a constructor



wangqin
4 May 2015, 10:35 PM
when I use GridFilters to filter column,firebug will tell me " TypeError: Cls is not a constructor " . who can help me to fix this? thanks!
5232852328

Gary Schlosberg
5 May 2015, 9:50 AM
A bit hard to say without seeing some of your code. Are you following this example?
http://dev.sencha.com/deploy/ext-3.4.0/examples/grid-filtering/grid-filter-local.html

wangqin
5 May 2015, 6:13 PM
I define one ColumnModel
var featureCm=new Ext.grid.ColumnModel({
// columns:[smFeature, {
columns:[new Ext.grid.RowNumberer(),smFeature,{
width:100,
header:'Group Name',
dataIndex:"teamId",
filter: {
type: 'string'
},
editor:new Ext.form.ComboBox({
fieldLabel:"Group name",
id:"groupCmb",
name:"groupCmb",
typeAhead : true,
lazyRender : false,
editable : false,
allowBlank : false,
store:artGlobal.storeManager.get("fwTeam"),
autoSelect : true,
emptyText : 'Select',
triggerAction : 'all',
mode : 'remote',
valueField : 'id',
displayField : 'teamName'
}),
renderer: function(value, metaData, record, rowIndex, colIndex, store) {
var teamStore=artGlobal.storeManager.get("team");
var index=teamStore.find("id",value);
var team=teamStore.getAt(index);
if(team){
var teamName=team.get("teamName");
return teamName;
}else
return value;
}
},{
width:100,
header:"Component/domain",
dataIndex:"component",
editor:new Ext.form.TextField()
},{
width:200,
header:"Feature name",
dataIndex:"featureName",
editor:new Ext.form.TextField()
}
]

});

then define GridFilters

var filters= new Ext.ux.grid.GridFilters({
encode : false,
local : true,

filters : [{
type : 'string',
dataIndex : 'teamId',
disabled : false
}]
});

and then add them to EditorGridPanel, is there some wrong?
var featureGridPanel=new Ext.grid.EditorGridPanel({
clicksToEdit:1,
// collapsible:true,
store:featureStore,
cm:featureCm,
sm:smFeature,
cls:"editGrid",
plugins:[filters],
width:"100%",
style: { marginBottom: '20px', marginTop:'10px'},
height:300 ,
tbar:[{
tooltip:"Copy from previous project",
iconCls:"icoCopy",
cls:"boldBtn",
text:"Copy from previous project",
handler:function(){
importWindow.show();
}
},"-",{
tooltip:"Add a feature",
iconCls:"icoAdd",
handler:function(){
var p = new featureRecord({
id:0
});
featureGridPanel.stopEditing();
featureStore.insert(0,p);
// featureGridPanel.startEditing();
}
},"-",{
tooltip:"Remove a feature",
iconCls:"icoDelete",
handler:function(){
if(featureGridPanel.getStore().getCount()==0){
Ext.Msg.alert("Warning", "No feature!");
return;
}
var selected = featureGridPanel.getSelectionModel().getSelections();
if (selected.length == 0){
Ext.Msg.alert("Warning","Please select a feature!");
return;
}
Ext.Msg.confirm("Message","Are you sure to delete this feature?",function(btn){
if(btn=="yes"){
for (var i = 0; i < selected.length; i++) {
featureStore.remove(selected[i]);
if(selected[i].get("id")!=0)
jsonMatrix.delFeatureList.push(selected[i].get("id"));
}
}});

/*if(featureGridPanel.getSelectionModel().getSelectedCell()==null){
Ext.Msg.alert("Warning","Please select a feature!");
return;
}

Ext.Msg.confirm("Message","Are you sure to delete this feature?",function(btn){
if(btn=="yes"){
var cell=featureGridPanel.getSelectionModel().getSelectedCell();
var record=featureStore.getAt(cell[0]);
featureStore.remove(record);
if(record.data.id!=0)
jsonMatrix.delFeatureList.push(record.data.id);
}
}); */
}
}]
});