GridViewDropDownCell SelectedChanged event

1990chs
Member Posts: 46
**
I add a GridViewDropDownCell in GridView, and I want to do something after the dropdowncell selectchanged. But I am not find the revelation event in GridView.
I have try to use AfterCellEdit event, but it seems to work before the dropdowncell text changed.
So I want to know is there any event after dropdowncell selectchanged ?
- BoltGridView = GridView()
- dropDownCell = Ansys.UI.Toolkit.GridViewDropDownCell()
- DropDownItems = []
- DropDownItems.append(GridViewDropDownCell.GridViewDropDownItem('Shank'))
- DropDownItems.append(GridViewDropDownCell.GridViewDropDownItem('Screw'))
- dropDownCell.AddItems(System.Array[GridViewDropDownCell.GridViewDropDownItem](DropDownItems))
- dropDownCell.Text = 'Shank'
- BoltGridView.Cells.SetCell(0, 0, dropDownCell)
Tagged:
0
Best Answer
-
This is solved.
From the args to get the StartRowIndex and type to do something after celledif- def DropDownChanged(self, sender, args):
- text = args.Value
- Cell = args.Cell
- RowIndex = Cell.StartRowIndex
- CellType = Cell.GetType()
- if CellType == self.DropDownCell:
- ExtAPI.Log.WriteMessage('Here')
- if text == 'Shank':
- self.Cells[RowIndex ,3].Text = ''
- self.Cells[RowIndex, 3].BackColor = Ansys.Utilities.Palette.LightGray
- self.Cells[RowIndex, 3].ReadOnly = True
- elif text == 'Screw':
- self.Cells[RowIndex, 3].BackColor = Ansys.Utilities.Palette.White
- self.Cells[RowIndex, 3].ReadOnly = False
0
Answers
-
You can use AfterCellEdit event, then check if the cell type is gridviewdropdowncell, then do something.
I don't find other event- def DropDownChanged(self, sender, args):
- text = args.Value
- Cell = args.Cell
- CellType = Cell.GetType()
- if CellType == self.DropDownCell:
- # do something
0