rally - How to create a combobox of possible values -
is there way dynamically populate combobox attributes property of artifact can take on?
e.g.
i have custom field set on user stories. want able populate combobox possible values custom field without hard-coding in.
in code below combobox automatically populated allowed values of custom field of dropdown type:
ext.define('customapp', { extend: 'rally.app.app', componentcls: 'app', items: [ { xtype: 'container', itemid: 'kbfilter' }, { xtype: 'container', itemid: 'grid', width: 800 } ], launch: function() { this.down('#kbfilter').add({ xtype: 'checkbox', cls: 'filter', boxlabel: 'filter table custom field', id: 'kbcheckbox', scope: this, handler: this._onsettingschange }); this.down('#kbfilter').add({ xtype: 'rallyattributecombobox', cls: 'filter', model: 'defect', field: 'mykb', listeners: { ready: this._onkbcomboboxload, select: this._onkbcomboboxselect, scope: } }); }, _onkbcomboboxload: function(combobox) { this.kbcombobox = combobox; rally.data.modelfactory.getmodel({ type: 'defect', success: this._onmodelretrieved, scope: }); }, _getfilter: function() { var filter = []; if (ext.getcmp('kbcheckbox').getvalue()) { filter.push({ property: 'mykb', operator: '=', value: this.kbcombobox.getvalue() }); } return filter; }, _onkbcomboboxselect: function() { if (ext.getcmp('kbcheckbox').getvalue()) { this._onsettingschange(); } }, _onsettingschange: function() { this.grid.filter(this._getfilter(), true, true); }, _onmodelretrieved: function(model) { this.grid = this.down('#grid').add({ xtype: 'rallygrid', model: model, columncfgs: [ 'formattedid', 'name', 'mykb' ], storeconfig: { context: this.context.getdatacontext(), filters: this._getfilter() }, showpagingtoolbar: false }); } });
in example have dropdown field name: mykb , display name: kb. in ws api name shows prepended c_, in c_mykb. however, if use c_mykb error comes up:
uncaught rally.ui.combobox.fieldvaluecombobox._populatestore(): field config must specified when creating rally.ui.combobox.fieldvaluecombobox
use display name of field, without spaces. here screenshot showing app in action:
Comments
Post a Comment