0
votes

I have a property grid :

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'
            },



        },

That has a render listener:

 beforerender: function(){

debugger;

                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);

Basically there is some logic to check if the data is correct/up to date and if its not it updates it. This works fine, but the data is not then loaded into the grid. I have to refresh after rendering the grid for it to load correctly.

Is there a way I can call a refresh or reload method on the property grid to load the data again inside an if statement?

1

1 Answers

0
votes

If I understand your question, I would suggest you to programm the store proxy so that it returns the whole changed record.
Is your store parametered with autoLoad enabled?
(sorry I can't (yet) comment)