-
18 Aug 2010 2:49 AM #1
XMLReader Filtern
XMLReader Filtern
Hi,
I've got a little problem, but I do not find any solutions for that!
I use the Ext.data.XMLReader to load a XML file to an Ext.data.Store.
But I want filter the XMl, so that for example only the tags where city=Berline are loaded!
That ist, how my XML looks like:Code:var doctorStore = new Ext.data.Store({ // load using HTTP url: 'test.xml', autoLoad:true, // the return will be XML, so lets set up a reader reader: new Ext.data.XmlReader({ record: 'people' }, [ {name: "title", mapping:"@title"}, {name: "name", mapping:"@name"}, {name: "city", mapping:"@city"}, {name: "country", mapping:"@country"}, ]), listeners:{ load :function(){ grid.getSelectionModel().selectFirstRow(); } } });
So, can someone help me pls?Code:<list> <people title='Dr.' name='Walter' city='Berlin' country='Germany'/> <people title='Dr.' name='Simon' city='Frankfurt' country='Germany'/> <people title='Dr.' name='Chris' city='Freiburg' country='Germany'/> <people title='Dr.' name='Jens' city='Berlin' country='Germany'/> </liste
Bolle87
I recognized that I do not use ext 2.x - I use ext 3.x!
-
18 Aug 2010 2:59 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 43
You could use:
Code:record: 'people[city=Berlin]'
-
18 Aug 2010 3:04 AM #3
-
23 Dec 2010 5:44 AM #4
-
23 Dec 2010 5:45 AM #5
operatorStoreReader = new Ext.data.XmlReader({
record:'ops'
},
[{
name:'opName',
mapping:'name'
},
{
name:'opType',
mapping:'type'
}]
);
operatorComboStore=new Ext.data.Store({
url:'operator.xml',
autoLoad:true,
reader: operatorStoreReader
});
myStore=new Ext.data.Store({
url:'UsersInfo.xml',
autoLoad:true,
reader: new Ext.data.XmlReader({
record:'employee',
id:'id'
},
[{
name:'columnName',
mapping:'colname'
},
{
name:'type',
mapping:'type'
}]
)
});
operatorCombo =new Ext.form.ComboBox({
id: 'operatorCombo',
forceSelection: true,
triggerAction: 'all',
editable:false,
lazyInit: false,
fieldLabel: 'Operator',
mode: 'local',
lastQuery:'',
store: operatorComboStore,
displayField:'opName'
}); // end of operatorCombo combo.
columnNameCombo =new Ext.form.ComboBox({
forceSelection: true,
editable:false,
id:'columnNameCombo',
triggerAction: 'all',
// selectOnFocus:true,
lazyInit: false,
displayField:'columnName',
store: myStore,
mode: 'local',
fieldLabel:'Column Name',
listeners: {
select: {
fn:function(combo, value) {
operatorCombo.clearValue();
operatorCombo.store.filter('opType', value.get('type'));
return;
}
}
}
}); // end of combo columnNameCombo.
myPanel = new Ext.FormPanel({
xtype : 'myPanel',
id:'myPanel1',
plain:true,
width:490,
height:170,
autoHeight:true,
buttonAlign : 'center',
items:[
firstGrid,
columnNameCombo,
operatorCombo,
{
id:'desired',
name:'desired',
xtype:'textfield',
fieldLabel:'Desired Value'
}
],
buttons: [ {
text:'Add Criteria',
handler:function addCriteria(){
where = Ext.getCmp('columnNameCombo').getValue();
qualifier=Ext.getCmp('operatorCombo').getValue();
desired = Ext.get('desired').getValue();
}
},{
text: 'Show Result',
handler:function search(){
where = Ext.getCmp('columnNameCombo').getValue();
qualifier=Ext.getCmp('operatorCombo').getValue();
desired = Ext.get('desired').getValue();
GetUserInfo.getUserInfo(where,qualifier,desired,{
callback : function(data){
result = Ext.util.JSON.decode(data);
displayResult(result); //call function to display grid.
}, // end callback function
errorHnadler:function(message){
Ext.Msg.alert('Error',message);
}
});
}
}]
}); // End of myPanel panel.
myWin = new Ext.Window({
width:500,
height:200,
autoHeight:true,
title:'Advance Search Window',
items: [myPanel]
}); // end of window.
myWin.show();
});
-
23 Dec 2010 5:47 AM #6
-
23 Dec 2010 5:58 AM #7
Similar Threads
-
BasicForm with XmlReader (reader) and XmlReader (errorReader) always calls success
By justinp in forum Ext 2.x: Help & DiscussionReplies: 5Last Post: 3 Feb 2009, 11:03 AM -
XmlReader
By asergey in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 8 May 2008, 7:27 AM -
XmlReader
By nazar_lv in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 22 Nov 2007, 9:41 AM -
XMLReader
By mhubert in forum Ext 1.x: Help & DiscussionReplies: 0Last Post: 31 May 2007, 3:07 PM -
xmlreader help....
By geniiyr in forum Ext 1.x: Help & DiscussionReplies: 7Last Post: 30 Mar 2007, 11:09 PM


Reply With Quote