2

I am building a rallygrid to display parent level stories. For each row, I want to iterate all the children of that story and pull some information from each child story. e.g.

    Ext.Array.each(data, function(record) {
        //Perform custom actions with the data here
        //Calculations, etc.
        recName=record.get('Name');
        if (recName.search(/\[Parent\]/i) != -1) {

            // Grab Child Iterations
            if (record.get('Children').length) {
                var childlist = record.get('Children');
                for (var child in childlist) {
                                       // I want to get each child's Iteration !!!
                }
            } else {
                childIter = "none";
            }

            records.push({
                FormattedID: record.get('FormattedID'),
                ScheduleState: record.get('ScheduleState'),
                Name: recName,
                NumChildren: record.get('Children').length,
                PRDNumber: record.get('PRDNumber')
            });
        }
    });

But, the record.get('Children') retuns objects that look like:

_rallyAPIMajor "1"
_rallyAPIMinor "34"
_ref "https://rally1.rallydev.com/slm/webservice/1.34/hierarchicalrequirement/7272142216.js"
_refObjectName "[Comp] User Story"
_type "HierarchicalRequirement"

I'm assuming there's some Ext call that will take the _ref URI, download it and parse out the JSON into a nice object I can start doing childrecord.get('field') on, but for the life of me, I can't find the right function to call.

Mat
  • 202,337
  • 40
  • 393
  • 406
CiscoDaveC
  • 23
  • 2

1 Answers1

0

You can use the load method of the record's model to retrieve a specific item as mentioned in this question/answer:

Rally App2.0 - Retrieve a specific story

In your case you can get the model from the existing record:

var model = record.self;
model.load(child.get('ObjectID'), {
    //options
});

However in your case if you're just looking for some info on each child story's iteration you can probably just include it in the fetch of your initial WsapiDataStore used to load the parent:

fetch: ['Children', 'Iteration', 'StartDate', 'EndDate']
Community
  • 1
  • 1
Kyle Morse
  • 8,390
  • 2
  • 15
  • 16
  • Thanks Kyle! Funny how "fetch: true" doesn't return as much information about a record's Children (i.e. no Iteration info) as when you explicitly list "fetch: ['Children']" Also, thanks for the model.load idea. The "child.get" method isn't available in the scope I'm working in, but I think I can massage out the OID from the child's _ref attribute. Will end up using both of these ideas ! – CiscoDaveC Aug 09 '12 at 20:53