0

Rally.data.WsapiDataStore にソーターを追加しようとしましたが、機能しませんでした。親のフィールドでソートすることは可能ですか?

Ext.create('Rally.data.WsapiDataStore', {
            model: 'UserStory',
            fetch: ['FormattedID','Name','HasParent','Parent'],
            pageSize: 100,
            autoLoad: true,
        sorters: [
            {
            property: 'Parent.FormattedID',
            direction: 'DESC'
            }
            ],
            listeners: {
                load: this._onDataLoaded,
                scope: this
            }
        });

また、「HasParent」でフィルタリングしようとしましたが、うまくいきませんでした。

filters: [
            {
            property: 'HasParent',
            operator: '=',
            value: true
            }
]

ありがとう!

4

2 に答える 2

0

親のストーリーの FormattedID によってグリッドがソートされる例を次に示します。ソーターは Rally.data.custom.Store に追加され、Rally.data.WsapiDataStore には追加されません。

    <!DOCTYPE html>
<html>
<head>
    <title>TCofUS</title>

    <script type="text/javascript" src="/apps/2.0rc1/sdk.js"></script>



    <script type="text/javascript">
        Rally.onReady(function () {
Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',

    launch: function() {
        Ext.create('Rally.data.WsapiDataStore', {
            model: 'UserStory',
            fetch: ['FormattedID','Name','HasParent','Parent'],
            pageSize: 100,
            autoLoad: true,
            listeners: {
                load: this._onDataLoaded,
                scope: this
            }
        });
    },

    _createGrid: function(stories) {
         this.add({
            xtype: 'rallygrid',
            store: Ext.create('Rally.data.custom.Store', {
                data: stories,
                pageSize: 100,
                 sorters: [
            {
            property: 'Parent',
            direction: 'DESC'
            }
            ],
            }),
            columnCfgs: [
                {
                   text: 'Formatted ID', dataIndex: 'FormattedID', xtype: 'templatecolumn',
                    tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate')
                },
                {
                    text: 'Name', dataIndex: 'Name'
                },
                {
                    text: 'Parent', dataIndex: 'Parent',
                   renderer: function(parent) {
                        return ('<a href="' + Rally.nav.Manager.getDetailUrl(parent) + '">' + parent + '</a>');
                   }
                }
            ]

        });
    },
    _onDataLoaded: function(store, data){
                var stories = [];
                Ext.Array.each(data, function(story) {
                            var parent = story.get('Parent');
                            var s  = {
                                FormattedID: story.get('FormattedID'),
                                Name: story.get('Name'),
                                _ref: story.get("_ref"),
                                 Parent: (parent && parent.FormattedID) || 'None',
                            };
                            stories.push(s);
                },
                this);
                 this._createGrid(stories);
    }             
});


            Rally.launchApp('CustomApp', {
                name:"TCofUS",
                //parentRepos:""
            });

        });
    </script>


    <style type="text/css">
.app {
     /* Add app styles here */
}

    </style>

</head>
<body></body>
</html>

フィルタに関する限り、WS API ドキュメントによると、 HasParent はクエリで使用できません。上記のコードは、親のふりをチェックし、親がない場合は「なし」を出力します。

 Parent: (parent && parent.FormattedID) || 'None'
于 2013-07-24T18:36:39.100 に答える
0

フィルターを使用する別の方法は、単純に Parent != '' でフィルター処理することです。

filters: [
{
    property: 'Parent',
    operator: '!=',
    value: ''
}

]

于 2013-10-16T00:35:55.443 に答える