问题
I created a custom app (using a Lookback query) that found any items that have been blocked within the last N days. It displays basic story/defect data, along with the duration of the "blockage" and the reason. Sadly, some stories have been blocked more than once.
I wanted to show a row in my display grid for each combination of story ID and blocked reason. However, I could not get that to work - it stubbornly showed only one row per id (e.g. US1243). After endless debugging, I found that I had to change the name of a field in my custom data store. I used to have this:
// inside a loop
var data = {
id : formattedID,
name : name,
planEstimate : size,
reason : reason,
duration : roundedDuration
};
list.push(data);
// later...
var myStore = Ext.create("Rally.data.custom.Store", {
data : list,
pageSize : 100
});
// and of course I use this as the store for a rally grid
To get it to show all of the data from the "list" array, I just had to change my "data" object to something like this:
var data = {
value : formattedID,
name : name,
planEstimate : size,
reason : reason,
duration : roundedDuration
};
(Note the replacement of "id" with "value". I had to change the "dataIndex" reference in the grid as well, of course.)
I searched and searched, but found no explanation for why it interprets the "id" attribute as needing to be unique. Is it the data store itself? The grid? I don't have the energy to track it down, now that I spent half a day debugging it.
Is there any Rally App SDK documentation that could explain this?
回答1:
This is actually a subtle behavior inherited from Ext. It is expected that all records in a store have a unique ID. The default id field is 'id', which is why in your first example you were only getting one row per id since each item in the store would overwrite any existing item with the same id. The second example works because there is no id specified, so Ext will auto-generate a unique one.
来源:https://stackoverflow.com/questions/22334745/does-rally-data-custom-store-have-magic-uniqueness