Rohan Dalvi
Rohan Dalvi

Reputation: 1265

Querying on DirectChildrenCount Rally JS SDK

I checked out some other questions posted previously but couldn't find a relevant answer. So here I am posting again: Here's my code:

Ext.create('Rally.data.WsapiDataStore',{
        autoLoad: true,
        model: 'HierarchicalRequirement',
        limit: '500',
        fetch: ['ObjectID','DirectChildrenCount','FormattedID'],
        filters:[{property: 'DirectChildrenCount', operator: '=', value: 0}], //tried both "0",'0'
        listeners: {
            load: function(store,data,success){
                var data_length = data.length;
                console.log("Number = ", data); 
            }
        }
    });

Result is an empty array. Furthermore, the result did not contain the field "DirectChildrenCount" at all, even though I am fetching it.

Upvotes: 1

Views: 78

Answers (1)

nickm
nickm

Reputation: 5966

I tried your code without any changes, and it returned 300+ items. DirectChildrenCount was included in the result. It was tested against "2.0rc2" and "2.0rc1" with the same result. Here is screenshot from Chrome's DevTools:

enter image description here

Here is another short app where a grid of stories updated since yesterday is built, filtered by the same condition.

{property: 'DirectChildrenCount', operator: '=', value: 0}

js file is below:

Ext.define('CustomApp', {
                extend: 'Rally.app.App',
                componentCls: 'app',

                launch: function() {
                    var millisecondsInDay = 86400000;            
                    var currentDate = new Date();
                    var startDate = new Date(currentDate - millisecondsInDay);
                    var startDateUTC = startDate.toISOString();

                    Rally.data.ModelFactory.getModel({
                        type: 'UserStory',
                        success: function(model) {
                            this.grid = this.add({
                                xtype: 'rallygrid',
                                itemId: 'grid',
                                model: model,
                                columnCfgs: [
                                    'FormattedID',
                                    'Name',
                                    'Owner',
                                    'LastUpdateDate'
                                ],
                                storeConfig: {
                                    filters: [
                                        {
                                            property: 'LastUpdateDate',
                                            operator: '>',
                                            value: startDateUTC
                                        },
                                        {
                                            property: 'DirectChildrenCount',
                                            operator: '=',
                                            value: 0
                                        },
                                    ]
                                }
                            });
                        },
                        scope: this
                    });
                    console.log('items updated since', startDateUTC);
                }

            });

Upvotes: 1

Related Questions