Tapped Event for Header Cells?

Is it possible to detect when a header cell is tapped?  The existing CellTapped event does not fire when a header cell is tapped.

6 Replies 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team November 5, 2020 12:05 PM UTC

Hi Dan Meier,

Thank you for contacting Syncfusion support.

Based on provided information Cell tapped event only trigger when the user clicks or touch the cell in SfDataGrid. CellTapped does not occurs when the end user clicks or touch the non-selectable cells GridHeaderCell. Could you please provide more details about your scenario with illustrations?

It will be helpful for us to check on it and provide you the solution at the earliest.

Regards,
Vijayarasan S 



DM Dan Meier November 9, 2020 03:48 AM UTC

Hello, Vijayarasan.  Thanks for your reply.  Please find two files in the attached .zip file.  The first -- "Original UI.jpg" -- shows a data grid with some sample data. Notice the "+" icon below the grid with a comment indicating that a user can tap it to add a new grid row.  The two left columns in the grid also have icons, but there's no easy way to indicate what they mean.  The columns are too narrow for meaningful information in the column header.

So the central question is this:  How can a new user know the meaning of these icons?  Their function may not be intuitively obvious for some users from the icon alone.

The second file in the attached .zip file -- "Proposed UI.jpg" -- shows a possible solution.  We use a "?" icon throughout our application to provide contextual help for users.  If a user taps on a "?" icon, they'll get context-sensitive information about a particular field.  The second file shows a "?" icon in the header of each icon column.  The new user will likely know to tap the "?" icon to learn about the function of the icon in the column.  That is, IF a header cell has a tap event.

Alternatively, is there a mouse-over even for individual grid cells or header cells?  If so, we might be able to display a tooltip indicating the function of one of these icons when a user mouses over the icon's cell.

Thanks in advance for your suggestions.

Attachment: TappedEventForHeaderCells_807e9d5c.zip


VS Vijayarasan Sivanandham Syncfusion Team November 10, 2020 06:13 PM UTC

Hi Dan Meier,

Thanks for the update.

Currently, we are analyzing your requirement of “Tapped Event for Header Cells in SfDataGrid”. We will validate and update you the details on or before November 12, 2020. 
 
We appreciate your patience until then. 
 
Regards, 
Vijayarasan S




VS Vijayarasan Sivanandham Syncfusion Team November 12, 2020 02:05 PM UTC

Hi Dan Meier,

Thank you for your patience.

Based on provided information your requirement can be achieved by enable the ShowHeaderToolTip property for GridColumn in SfDataGrid. In this case mouse hover in GridHeaderCell when CellToolTipOpening event triggered in SfDataGrid. Your requimrenet ca be achieved by customization ToolTip content in CellToolTipOpening event in SfDataGrid. Please refer the below code snippet for your reference,

XAML Code snippet: 
<syncfusion:SfDataGrid x:Name="dataGrid"                                                          
                               AutoGenerateColumns="False"                                                             
                               ItemsSource="{Binding OrderList}"> 
            <syncfusion:SfDataGrid.Columns> 
                <syncfusion:GridDateTimeColumn  ShowHeaderToolTip="True" 
                                                AllowEditing="True"                                                   
                                                HeaderTemplate="{StaticResource headerTemplate}"                                                  
                                                Width="200"                                                                               
                                                MappingName="OrderDate">                     
                </syncfusion:GridDateTimeColumn> 
                <syncfusion:GridImageColumn ShowHeaderToolTip="True"                                           
                                            HeaderTemplate="{StaticResource headerTemplate}"                                             
                                            ImageHeight="50" 
                                            ImageWidth="50" 
                                            MappingName="ImageLink" 
                                            ValueBinding="{Binding Path=ImageLink, 
                                                                   Converter={StaticResource stringToImageConverter}}" /> 
                <syncfusion:GridTextColumn MappingName="ProductId"/> 
                <syncfusion:GridTextColumn MappingName="ProductName" /> 
                <syncfusion:GridTextColumn MappingName="CountryName" /> 
                <syncfusion:GridTextColumn MappingName="ShipCity" /> 
                <syncfusion:GridTextColumn MappingName="ShipId"/>                
            </syncfusion:SfDataGrid.Columns> 
</syncfusion:SfDataGrid> 

C# Code snippet: 
dataGrid.CellToolTipOpening += DataGrid_CellToolTipOpening;

private void DataGrid_CellToolTipOpening(object sender, GridCellToolTipOpeningEventArgs e) 
            string information = string.Empty; 
            if (this.dataGrid.GetHeaderIndex() == e.RowColumnIndex.RowIndex && e.RowColumnIndex.ColumnIndex == 0) 
            { 
                 information = "First Column Information"; 
                 e.ToolTip.Content = information; 
            } 
            else if (this.dataGrid.GetHeaderIndex() == e.RowColumnIndex.RowIndex && e.RowColumnIndex.ColumnIndex == 1) 
            { 
                 information = "Second Column Information";                
                 e.ToolTip.Content = information; 
            } 
}   

We hope this helps. Please let us know, if you require further assistance on this.

Regards,
Vijayarasan S 


Marked as answer

DM Dan Meier November 13, 2020 01:40 AM UTC

Hello, Vijayarasan.  Your solution is terrific -- it works well for us!

As usual, you guys are fantastic!   Many thanks!


SS Sampathnarayanan Sankaralingam Syncfusion Team November 13, 2020 09:05 AM UTC

Hi Dan Meier, 
 
Thank you for contacting Syncfusion support. 
 
We are glad to know that the provided solution worked at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Sampath Narayanan. S 


Loader.
Up arrow icon