Filtering items in a rallymultiobjectpicker

67 Views Asked by At

I want to present the user with a checkbox list of portfolio item features which are currently assigned to a particular release.

The rallymultiobjectpicker with modelType set to portfolioitem/feature looks perfect for this, but it is unclear to me how to filter the objects that it displays.

Presumably this is in the storeConfig parameter? I've tried the following to no effect:

     {
            xtype: 'rallymultiobjectpicker',
            modelType: 'portfolioitem/feature',
            fieldLabel: 'Select Features',
            storeConfig: {
                filters: [{
                    property: 'Release.Name',
                    operator: '=',
                    value: myRelease
                }]
            },
    }
1

There are 1 best solutions below

0
curmudgeon On

As a workaround until the bug is fixed, you might try filtering on the load, like this:

{
    xtype: 'rallymultiobjectpicker',
    modelType: 'portfolioitem/feature',
    fieldLabel: 'Select Features',
    storeConfig: {
        fetch: ['Release','Name']
    },
    storeLoadOptions: function(records) {
        var store = this;
        Ext.Array.each(store.getRecords(), function(record,idx){
            var release = record.get('Release');
            var name = null;
            if ( !release || release.Name !== myRelease ) {
                store.remove(record);
            }
         });
     }
 }

It's going to be slower because it goes and gets all the features first, but it seems to work.