我有一个静态树存储,我想过滤我的树。为此,我添加了一个 tbar。如何从这个 tbar 的文本字段中过滤我的树?
这是我的静态数据商店
Ext.define('TestApplication.store.TreeStoree', {
extend: 'Ext.data.TreeStore',
root: {
expanded: false,
children: [{
text: "Project",
expanded: false,
children:[
{ id: '1', text: "Transaction", leaf: true },
{ id: '2', text: "Query", leaf: true },
{ id: '3', text: "Report", leaf: true },
{ id: '4', text: "Initialization", leaf: true },
{ id: '5', text: "Sequence", leaf: true },
{ id: '6', text: "Batch", leaf: true }
]
}, {
text: "Records Display",
expanded: false,
children: [
{ id: '7', text: "Previous", leaf: true },
{ id: '8', text: "Running", leaf: true }
]
}, {
text: "Photo",
expanded: false,
children: [
{ id: '9', text: "Specimen", leaf: true }
]
}, {
text: "Signature",
expanded: false,
children: [
{ id: '10', text: "Carbon Copy", leaf: true }
]
}, {
text: "D N A",
expanded: false,
children: [
{ id: '11', text: "Plastrain", leaf: true },
{ id: '12', text: "Generic", leaf: true }
]
}]
}
});
在本节中,我添加了一个带有文本字段的 tbar 并希望从中进行搜索
Ext.define('TestApplication.view.display.TreeView' ,{
extend: 'Ext.tree.Panel',
alias : 'widget.treeView',
rootVisible: false,
useArrows: true,
border:true,
initComponent: function() {
var me = this;
me.tbar = [
{
xtype: 'treefilter',
emptyText: 'Search',
store: 'TreeStoree',
flex: 1
}
];
me.callParent(arguments);
}
});
我的自定义 treeFilter
Ext.define('TestApplication.view.display.CustomFilter', {
extend: 'Ext.form.field.Trigger',
alias: 'widget.customfilter',
trigger1Cls: Ext.baseCSSPrefix + 'form-clear-trigger',
trigger2Cls: Ext.baseCSSPrefix + 'form-search-trigger',
initComponent: function() {
var me = this;
me.callParent(arguments);
me.on('change', function(){
me.onFilterStore();
});
},
onFilterStore : function(){
// what will be my codes here..........???????????????????
}
});