grid - Rally Grid 加载事件未触发

标签 grid load listener rally

我一直在尝试确保 Rally.ui.grid.Grid 中的加载事件正在触发,因为我遇到了问题,因为我的网格没有过滤。我尝试调用方法 myStore.setFilter() 和 myStore.load(),这两个方法正在触发,但我无法确定网格从第一次开始就正常工作,当它全部加载时,它会正确执行过滤,但当我更改下拉列表或组合框时,它不会。

这是我加载 myStore 的方式:

this.myStore=Ext.create("Rally.data.wsapi.Store",{
                    model:"Task",
                    autoLoad:true,
                    filters: myFilters,
                    listeners:{
                        load:function(myStore,myData,success){

                            if(!this.myGrid) //IT CREATES THE GRID FOR THE FIRST TIME
                                {
                                    this._loadGrid(myStore)
                                    console.log('Grid Created!');
                                    // this.myStore.setFilter();
                                    // this.myStore.load();
                                }
                                else
                                {
                                    this.myStore.setFilter();
                                    //this.myStore.load();
                                    console.log('Grid reloaded!');
                                    console.log(myFilters);
                                }
                            },
                            scope:this
                        },
                    fetch:["FormattedID","State","Iteration", "Release"]
                }

                )
            }

这就是我加载 myGrid 的方式:

_loadGrid:function(myStoryStore){
            this.myGrid = Ext.create("Rally.ui.grid.Grid",{
                store:myStoryStore,
                columnCfgs:["FormattedID","State","Iteration", "Release"],
                listeners: {
                    load: function(myGridy){
                        console.log('myGrid did load!');
                    },
                    scope:this
                }
                });

            this.add(this.myGrid);
    }

最佳答案

这是 David Thomas 的一个示例,来自 his videos on building Rally apps使用 reconfigure 方法来传递存储:_myGrid.reconfigure(myStore)

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

launch: function() {
    var relComboBox = Ext.create('Rally.ui.combobox.ReleaseComboBox',{
        listeners:{
            ready: function(combobox){
                //console.log('loaded release name', combobox.getRecord().get('Name')); //getRecord() returns currently selected item
                var releaseRef = combobox.getRecord().get('_ref'); 
                this._loadStories(releaseRef);
                //console.log('what is this', this);
            },
            select: function(combobox){
                var releaseRef = combobox.getRecord().get('_ref'); 
                this._loadStories(releaseRef);
            },
            scope: this
        }
    });
    this.add(relComboBox);
},

_loadStories: function(releaseRef){
    console.log('loading stories for ', releaseRef);

    var myStore = Ext.create('Rally.data.WsapiDataStore',{
        model: 'User Story',
        autoLoad:true,
        fetch: ['Name','ScheduleState','FormattedID'],
        filters:[
            {
                property : 'Release',
                operator : '=',
                value : releaseRef
            }
        ],
        listeners: {
            load: function(store,records,success){
                console.log("loaded %i records", records.length);
                this._updateGrid(myStore);
            },
            scope:this
        }
    });
},

_createGrid: function(myStore){
    console.log("load grid", myStore);
    this._myGrid = Ext.create('Ext.grid.Panel', {
        title: 'Stories by Release',
        store: myStore,
        columns: [
                {text: 'ID', dataIndex: 'FormattedID', flex: 1},
            {text: 'Story Name', dataIndex: 'Name', flex: 2},
            {text: 'Schedule State', dataIndex: 'ScheduleState', flex: 2}
        ],
        height: 400
    });
    this.add(this._myGrid);
},

_updateGrid: function(myStore){
    if(this._myGrid === undefined){
        this._createGrid(myStore);
    }
    else{
        this._myGrid.reconfigure(myStore);
    }
}

});

关于grid - Rally Grid 加载事件未触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21436197/

相关文章:

JavaFx:如何正确触发 TableCell 中的 updateItem

r - 动态轴在绘图区域的顶部和底部滴答作响,循环时具有一致的间隔数和一致的宽度(ggplot2、grid.arrange)

hadoop - pig 自定义函数加载多个字符 ^^(双胡萝卜)定界符

wpf - 为什么 WPF Grid.Rows 是从零开始的,而不是相对的?

load - 一个设计如何对网站进行负载测试?

javascript - 如何让 ASP.net 在 JavaScript jQuery.Load 调用中填写本地服务器

java - 添加鼠标监听器后进程不会关闭

javascript - 套接字IO : Client side 'connect' event not firing when socket is already setup

css - 如何在CSS网格中设置子宽度为父宽度的10%

java - 按 T​​ab 键时,重点不要转到 GXT EditorGrid 中的下一个字段