Sep 03, 2009, 1:01 AM
[CLOSED] disable/enable gridcommand
Hi
I have tried many things but I am unable to do the following. this is what I am trying to do.
I have grid with 3 columns and 2 GridCommands (Upload and View). I would like to disable the View Command if the Filename column is empty.
idriss
I have tried many things but I am unable to do the following. this is what I am trying to do.
I have grid with 3 columns and 2 GridCommands (Upload and View). I would like to disable the View Command if the Filename column is empty.
<ext:GridPanel ID="grid2" runat="server" Header="false" Frame="true" Visible="true"
StoreID="store2" AutoScroll="true">
<ColumnModel ID="ColumnModel2" runat="server">
<Columns>
<ext:Column ColumnID="ArchiveDesc" Header="Description" DataIndex="ArchiveDesc" Width="320"
Sortable="true">
</ext:Column>
<ext:Column ColumnID="Filename" DataIndex="Filename" Header="Filename" Width="280">
<%-- <Renderer Fn="change" />--%>
</ext:Column>
<ext:Column ColumnID="ArchiveID" Header="ArchiveID" DataIndex="ArchiveID" Width="60"
Sortable="true">
</ext:Column>
<ext:CommandColumn Width="90" Header="Actions" ColumnID="CommandButtons">
<Commands>
<ext:GridCommand Icon="FolderExplore" CommandName="Upload">
<ToolTip Text="Upload Document" />
</ext:GridCommand>
<ext:GridCommand Icon="ApplicationFormMagnify" CommandName="View">
<ToolTip Text="View Document" />
</ext:GridCommand>
</Commands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
<AjaxEvents>
<RowSelect OnEvent="GridPanel1_RowSelectedChanged">
<ExtraParams>
<ext:Parameter Name="ArchiveID" Value="this.getSelected().data['ArchiveID']" Mode="Raw" />
</ExtraParams>
<EventMask ShowMask="false" />
</RowSelect>
</AjaxEvents>
</ext:RowSelectionModel>
</SelectionModel>
<Listeners>
<Command Fn="commandHandler" />
</Listeners>
<LoadMask ShowMask="true" />
<SaveMask ShowMask="true" />
<BottomBar>
<ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="20" StoreID="store2"
DisplayInfo="true" AutoWidth="true" />
</BottomBar>
<Buttons>
</Buttons>
</ext:GridPanel>
I have setup the following just to see if it gets called but it is not being called.
function setButton(grid, command, record, rowIndex) {
Ext.Msg.alert(command, record.data.Filename);
if (record.data.Filename.length > 0) {
//command.iconCls = 'icon-up';
// ENABLE COMMAND
}
else {
// command.iconCls = 'icon-down';
// DISABLE COMMAND
}
}
Can you point me in the right direction. thanksidriss