-
Notifications
You must be signed in to change notification settings - Fork 34
Use a personnal list on a selectFor field
Tsj- edited this page Jun 11, 2015
·
5 revisions
You can use a personnal list with the selectFor field. That allow you to filter a referenceList for example, or concat many lists in one etc.
To do that you first have to initialize your list, and put it in the state of your component. Here we'll create a static list:
getInitialState: function getInitialStateDonneeDescription(){
var moduleList;
moduleList = [
{
"code": 1,
"label": "Annuaire",
"active": true,
"dependence": 1
},
{
"code": 2,
"label": "Module_de_Test",
"active": true,
"dependence": 2
}
];
return {
refList: {
moduleList: moduleList
}
};
}
Now you can use it in your selectFor field. You just have to use your list name and to reference the refContainer with your new refList object:
renderContent: function render(){
return (
<Block title={i18n.t('donnee.description.title')} actions={this._renderActions}>
<div>{this.selectFor('module', listName='moduleList', {refContainer:this.state.refList})}</div>
</Block>
);