View Full Version : [CLOSED] Grid: Display CommandIcon only on selection

Nov 14, 2013, 3:13 PM

A commandColumn has a property "OverOnly", this causes the command to appear on mouseover only.

I have a single selection grid, and its very very important to see which column is selected (before doing some action withe a button click)

I need more than just the highlighted background as optical feedback in that case.

Is there a way to display an icon in a commandcolumn if the row is selected?

In other words, I would need the behavior of "OverOnly" for "SelectionOnly" ;)

Nov 14, 2013, 9:39 PM

Unfortunately we don't have such functionality but we will discuss it.

Nov 15, 2013, 3:11 AM
Hi everybody,

What about the following?


<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
if (!X.IsAjaxRequest)
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
new object[] { "test", "test" },
new object[] { "test", "test" },
new object[] { "test", "test" }

<!DOCTYPE html>

<head runat="server">
<title>Ext.NET v2 Example</title>

var prepareToolbar = function (grid, toolbar, rowIndex, record) {
return grid.getSelectionModel().isSelected(record);
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server" Height="150">
<ext:Store runat="server">
<ext:Model runat="server">
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" />
<ColumnModel runat="server">
<ext:Column runat="server" Text="Test 1" DataIndex="test1" />
<ext:Column runat="server" Text="Test 2" DataIndex="test2" />
<ext:CommandColumn runat="server">
<ext:GridCommand CommandName="testCommand" Icon="Accept" />
<PrepareToolbar Fn="prepareToolbar" />
<ext:RowSelectionModel runat="server" Mode="Single">
<SelectionChange Handler="this.view.refresh();" />

Nov 15, 2013, 4:06 PM
Thank you Daniil,

i have a about 200 Records in my grid, and unfortunately the browser hangs for a few seconds after each selection.

I have tried it with the more performant ImageCommandColumn, but somehow all rows display the accept icon.

I used the code above, I did only change the colum:

<ext:ImageCommandColumn ID="CommandColumn1" runat="server">
<ext:ImageCommand CommandName="testCommand" Icon="Accept" />
<PrepareCommand Fn="prepareToolbar" />

any idea whats wrong?

Nov 15, 2013, 4:15 PM
Yes, a full refresh for such amount of rows is too heavy.

Please try this:

<ext:RowSelectionModel runat="server" Mode="Single">
<BeforeSelect Handler="var last = this.getLastSelected();

if (last) {
this.view.refreshNode(this.view.store.indexOf(last ));
}" />

<Select Handler="this.view.refreshNode(index);" />