I'm having a hard time figuring out how to retrieve a set of stories using a tag name (TagName) as a filter. I have tried the following, but it always returns an empty store (the alert at the bottom returns []). Can someone help me figure out what I'm doing wrong?
var storyStore = Ext.create('Rally.data.wsapi.Store', {
model: "User Story",
fetch: true,
filters: [
{
property: 'Tags.Name',
operator: '=',
value: 'TagName'
}
]
});
storyStore.load({
callback: function(records, operation) {
if(!operation.wasSuccessful()) {
//process records
}
}
});
alert(JSON.stringify(storyStore.getRecords()));
Any help would be greatly appreciated!!!
This is due to the asynchronous nature of the store.load call. Your store and filters look totally right. Try putting your alert inside of the if statement within your callback. I bet you'll find there is data in there then:
storyStore.load({
callback: function(records, operation) {
if(operation.wasSuccessful()) {
alert(JSON.stringify(storyStore.getRecords()));
}
}
});