Skip to content

Dynamic options list in Editable select column #1423

@yakirg

Description

@yakirg

I have a problem where I have one column that is a type and another that is a refine on said type:

const posTypes = ["Any", "Noun", "Verb", "Adjective", "Adverb", "Cardinal number"];
const posRefineTypes = {
  "Any": [],
  "Noun": ["Any", "Single", "Plural", "Proper noun single", "Proper noun plural"],
  "Verb": ["Any", "Base form", "Past tense", "gerund or present participle", "past participle", "non-3rd person singular present", "3rd person singular present"],
  "Adjective": ["Any", "Comparative", "Superlative"],
  "Adverb": ["Any", "Comparative", "Superlative"],
  "Cardinal number": []
};
...

           <TableHeaderColumn
                dataField='Pos' editable={ {type: 'select', options: {values: posTypes}} }
                width={"120px"}>
              Pos
            </TableHeaderColumn>

            <TableHeaderColumn
                dataField='Refine'
                editable={  {type: 'select', options: {values: posRefineTypes[Pos]}} }
                width={"120px"}>
              Refine
            </TableHeaderColumn>   

I need the options in the sub type to match the type, but it has to be a constant.

Is there a way to get it done?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions