View Full Version : [CLOSED] Display ComboBox in GridPanel depending on value in other column

Dec 14, 2012, 1:55 PM

Not long ago I got a GridPanel working in such a way that a button in a column (CommandColumn) is only shown when a contents in another column is of a certain value.
I now want to do the same with a ComboBox in the GridPanel.
For the Button I used a PrepareToolbar in the CommandColumn.

In tried to implement a ComboBox in a ComponentColumn, but there not something like a PrepareToolbar.
First question: how to get the combobox hidden for records meeting a certain value.
Second question: is it also possible to fill the contents of a combobox with items depending on the value of another column? Or is it easier to make two comboboxes in the same column and display/hide these depending on the value?


<script type="text/javascript">
var prepareToolbar = function (grid, toolbar, rowIndex, record) {
if (record.get("datatypeid") !== 4) {
//hide edit button

<ext:CommandColumn ID="CommandColumn2" runat="server" Text="test" Width="55" MaxWidth="55" >
<ext:GridCommand icon="ApplicationViewTile" CommandName="themeconstruction" >
<ToolTip Text="Thema" />
</ext:GridCommand >
<PrepareToolbar Fn="prepareToolbar" />
<Command OnEvent="Command_Handler">
<ExtraParams >
<ext:Parameter Name="command" Value="command" Mode="Raw" />
<ext:Parameter Name="datatypeid" Value=" record.data.datatypeid" Mode="Raw" />

For the ComboBox:

<script runat="server">
If (Not Page.IsPostBack) Then
If (Not ExtX.IsAjaxRequest) Then
ComboBoxTheme.Items.Add(New Ext.Net.ListItem("item0", "0"))
ComboBoxTheme.Items.Add(New Ext.Net.ListItem("item1", "1"))
ComboBoxTheme.Items.Add(New Ext.Net.ListItem("item2", "2"))
ComboBoxTheme.Items.Add(New Ext.Net.ListItem("item3", "3"))
End If
End If

<ext:ComponentColumn ID="ComponentColumn1"
Text="Theme" MinWidth="150">
<ext:ComboBox ID="ComboBoxTheme" runat="server" Editable="false" EnableKeyEvents="false" >

Dec 14, 2012, 6:16 PM
Hi Hans,

Please use the ComponentColumn's Bind event. Returning false from a Bind listener will hide a ComboBox.

Also there are the "cmp" (it will a ComboBox instance) and "record"" arguments. You should be able to load required data using these arguments.