Rally Software

 View Only
  • 1.  Setting context for an app

    Posted Jun 24, 2020 02:48 PM
    Hi ,

    I am creating custom using below code and wanted to check the option to pass context using the code.
    Irrespective of what i pass, the code is fetching data from a default workspace (i don't know how it is picking that particular workspace) and sample project under it. not sure what am missing

    Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',
    launch: function() {
    //Write app code here
    console.log('My 3rd App');
    //API Docs: https://help.rallydev.com/apps/2.1/doc/
    //this._loadData();
    this._loadIterations();
    },
    _loadIterations: function(){
    this.iterComboBox= Ext.create('Rally.ui.combobox.IterationComboBox', {
    listeners: {
    ready: function(combobox){
    this._loadData();
    console.log('ready',combobox);

    },
    select: function(combobox,records){
    this._loadData();
    },
    scope: this
    }
    });
    this.add(this.iterComboBox);

    },
    _loadData: function(){
    var selectedIterRef= this.iterComboBox.getRecord().get('_ref');
    console.log('selected iter:',selectedIterRef);
    var myStore = Ext.create('Rally.data.wsapi.Store', {
    model: 'Defect',
    context: {
    workspace : '/workspace/1234',
    //project: 'project/1234',
    projectScopeDown: true
    },
    Filters: [
    {Property: 'Iteration',
    Operation: '=',
    Value: selectedIterRef
    }

    ],
    autoLoad: true,
    listeners: {
    load: function(myStore, myData, success) {
    //process data
    console.log('Got data',myStore,myData,success);
    this._loadGrid(myStore);

    },
    scope: this
    },
    fetch: ['FormattedID','Name', 'Iteration','Severity']
    });

    },
    _loadGrid: function(myStoryStore){
    var myGrid = Ext.create(Rally.ui.grid.Grid,
    {
    store: myStoryStore,
    columnCfgs: [
    'FormattedID','Name','Iteration','Severity' ]
    }) ;
    console.log('my grid',myGrid);
    this.add(myGrid);
    console.log('what is this?' , this);
    }

    });


  • 2.  RE: Setting context for an app
    Best Answer

    Broadcom Employee
    Posted Jun 24, 2020 04:02 PM
    Hi Divya,

    There are a few reasons for setting context, but occasionally, it is better without. Here is an example of using context to get data into a store:
    https://github.com/nikantonelli/Planning-Poker/blob/a563f5fe456e7f17cba2fe5d7ef2db0b1d6767f1/App.js#L49

    If you want to only get stuff from where the user is scoped to (e.g. Project), then you use a context. If you are looking to find data that might not necessarily be in the same project, then you might want to leave out the context.


    ------------------------------
    Nik
    Ask me a question, I'm All Ears!
    Rally Sales Engineer
    Rally Software
    ------------------------------