【问题标题】:ExtJS property grid reload after render渲染后 ExtJS 属性网格重新加载
【发布时间】:2015-09-16 02:30:04
【问题描述】:

我有一个属性网格:

periods.each(function(record){

var tempPropGrid = me.getView().add(
    {
        xtype:'propertygrid',

        width: 80,
        header: false,
        title: 'prop grid',
        //for some reason the headers are not hiding, we may need to deal with this using CSS
        //hideHeaders: true,
        enableColumnResize: false,
        sortableColumns: false,
        nameColumnWidth: 1,
        source: record.data,
        sourceConfig: {

            periodScrumMaster: {
                editor: Ext.create('Ext.form.ComboBox', {
                    tdCls: 'red',
                    store: team,
                    queryMode: 'local',
                    displayField: 'personName',
                    valueField: 'personName',

                    listeners: {
                        'expand' : function(combo) {
                            var gridvalues = this.up('propertygrid').getSource();
                            combo.getStore().clearFilter(true);
                            combo.getStore().addFilter({property: 'teamName', value: teamName});
                            combo.getStore().addFilter({property: 'periodName', value: gridvalues.periodName});
                            var totalFTE = team.count();
                            console.log(totalFTE);
                            var teamStore = Ext.getStore('personPeriods');
                            console.log('store');
                            console.log(teamStore);
                        },
                    }}),
                displayName: 'Scrum Master'
            },



        },

有一个渲染监听器:

 beforerender: function(){

调试器;

                var gridValues = this.getSource();
                // console.log(record);
                //debugger;


                // filter periods for this period only
                periods.filterBy(function(record,id){
                    if(record.get("periodName") === gridValues.periodName){
                        return true;
                    }});

                // filter teamMembers for this period and team
                var view = this.up();
                var vm = view.getViewModel();
                var store = vm.getStore('teamMembers');
                store.filterBy(function(record,id){
                    if(record.get("periodName") === gridValues.periodName)    {
                        return true;
                    }});
                //store.clearFilter(true);
                store.addFilter({property: 'teamName', value: teamName});
                // get FTEs assigned to this team in this period by counting records
                var resourcedFtes = store.count();


                // Here I check the record in the periods store to make sure the data matches up with how many resourcedFte there is an update it if required
                // This is super bad and will need to refactor
                periods.each(function(record,idx){
                    var value = record.get('resourcedFte');
                    if(value != resourcedFtes){
                        record.set('resourcedFte',resourcedFtes);
                        record.commit();
                        vm.data.parentController.saveParent();

                    }});
                // Need to call save parent so that the record is updated when we update it above

                //Clear everything so that we can start fresh next period
                store.clearFilter(true);
                //periods.clearFilter(true);

基本上有一些逻辑可以检查数据是否正确/最新,如果不是,它会更新它。这工作正常,但数据不会加载到网格中。我必须在渲染网格后刷新才能正确加载。

有没有一种方法可以在属性网格上调用刷新或重新加载方法以在 if 语句中再次加载数据?

【问题讨论】:

    标签: javascript extjs


    【解决方案1】:

    如果我理解您的问题,我建议您对商店代理进行编程,以便它返回整个更改的记录。
    您的商店是否启用了autoLoad 参数?
    (对不起,我不能(还)发表评论)

    【讨论】:

      猜你喜欢
      • 2011-05-26
      • 2013-07-31
      • 1970-01-01
      • 1970-01-01
      • 2011-11-17
      • 2014-10-11
      • 2012-10-14
      • 2021-05-03
      • 2013-11-25
      相关资源
      最近更新 更多