PDA

View Full Version : [CLOSED] Show hide a ImageCommandColumn AFTER the Grid Data are loaded



Peter.Treier
Aug 26, 2014, 11:45 AM
Hi all

I got to Show an Icon in Grid representing a state. The state is provided after the grid data is loaded. I was thinking about a loop trough all records a receive with

var records = store.getAllRange();
var i = 0;

while (i < records.length) {
// --> get the ImageCommandColumn here and set her tho visible

i++;
}



I can't find the way to grab the image command column :-(

Any hint for this ?

Peter

Daniil
Aug 26, 2014, 2:14 PM
Hi Peter,

Please clarify does this not work?

App.ImageCommandColumnId.show();

App.ImageCommandColumnId.hide();

Peter.Treier
Aug 26, 2014, 2:45 PM
nope... doesn't :-(

To clarify the Code, here's my Grid Mark up


<ext:GridPanel runat="server" ID="gridItem" AutoScroll="true">
<ColumnModel>
<Columns>
<ext:CommandColumn ID="colEdit" runat="server" Width="120" Visible="False">
<Commands>
<ext:GridCommand Icon="Delete" CommandName="cmdDelete" Text="Delete" />
</Commands>
<Listeners>
<Command Handler="handleItem(command, record);" />
</Listeners>
</ext:CommandColumn>
<ext:Column ID="colId" runat="server" DataIndex="Id" Text="Id" Width="100" Hidden="True" Groupable="False" Sortable="False" MenuDisabled="True" />
<ext:Column ID="colItemNumber" runat="server" DataIndex="ItemNumber" Align="Right" Width="30" Groupable="true" Sortable="true" MenuDisabled="False" />
<ext:Column ID="colDescription" runat="server" DataIndex="Description" Width="200" Hidden="False" Groupable="true" Sortable="true" MenuDisabled="False" Flex="1" />
<ext:NumberColumn ID="colNetMass" runat="server" DataIndex="NetMass" Align="Right" Width="75" Hidden="False" Groupable="true" Sortable="true" MenuDisabled="False" Format="0.00" />
<ext:NumberColumn ID="colGrossMass" runat="server" DataIndex="GrossMass" Align="Right" Width="75" Hidden="False" Groupable="true" Sortable="true" MenuDisabled="False" Format="0.00" />

<ext:ImageCommandColumn ID="colError" Width="30" runat="server" ">
<Commands>
<ext:ImageCommand Icon="Error" CommandName="cmdHasError" Hidden="true" />
</Commands>
</ext:ImageCommandColumn>

</Columns>
</ColumnModel>

<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel" runat="server" Mode="Single" />
</SelectionModel>
<Listeners>
<SelectionChange Handler="Ext.net.Mask.show({ msg : 'Loading...' });loadItemDetail(item, selected); " />
</Listeners>
<Store>
<ext:Store ID="storeDeclarationItem" runat="server">
<Model>
<ext:Model ID="modelDeclarationItem" runat="server">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="ItemNumber" Type="Int" />
<ext:ModelField Name="Description" />
<ext:ModelField Name="NetMass" Type="Float" />
<ext:ModelField Name="GrossMass" Type="Float" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Plugins>
<ext:BufferedRenderer />
</Plugins>
</ext:GridPanel>

The Error Checking is done by an async Method called after the Data loading. Therefore I need to set the Column 'colError' Visibility Record by Record...

Thank's for the Help
Peter

Daniil
Aug 26, 2014, 5:47 PM
Therefore I need to set the Column 'colError' Visibility Record by Record...

You probably mean that you need to show the ImageCommand (not a column, but a command) for some rows and hide for others.

I guess you should use an ImageCommandColumn's PrepareCommand. Please look at the example.
http://examples2.ext.net/#/GridPanel/Commands/Prepare_Commands/