Migration Questions

Hi,

I'm currently migrating from a competitor's control suite.
With the DataGrid I miss the following functionality:

a.)     Quick search
- I'm used to hit CTRL+F which creates a new line on top of the grid with a textbox. There I can enter text which is used to search the whole grid (all columns) for the entered text using "contains". To enable this I just set "EnabelSearch=True".
Searching help I just found that I have to somehow create a textbox, a button and then I have to write code to make the search work.
Am I missing something or does SFDataGrid not support such a feature without tweaking the UI by myself?

b.) Copy and paste on column level.
- With the competitors control I enable "RowHeader" which shows an extra small column in front of every row.
When I click this rowheader the row gets marked and CTRL+C copies the whole row (all columns).
On the other hand - when I select a column and hit CTRL+C only the content of this column is copied.

c.) Hyperlink Text / Hyperlink URI in HyperLinkColumn
- With the competitor a hyperlink column has a "URI" property which set's the URI (and also the text if nothing different is given).
Further there is a "HyperLinkText" property where I can bind a text - if set this is displayed in the column.
Example - Text="Details" URI="https://somedomain.so/now/a/long/nasty/link?whitsome=parameters"
Or: Text="[email protected]" with the URI "mailto:[email protected]"
I found no information how to do this with your control but it is essential because I often use long URLs which make the column extremely wide and unreadable.
By the way - I can make a template I know - but using a TextBlock shows a different optical representation (not blue, not underlind). And setting this value (Foreground, decoration) also doesn't work when I use different themes.

4 Replies 1 reply marked as answer

MA Mohanram Anbukkarasu Syncfusion Team June 2, 2021 06:23 AM UTC

Hi ManniAT, 

Thanks for contacting Syncfusion support.  

Query 
Response 
a.)     Quick search
- I'm used to hit CTRL+F which creates a new line on top of the grid with a textbox. There I can enter text which is used to search the whole grid (all columns) for the entered text using "contains". To enable this I just set "EnabelSearch=True". 
Searching help I just found that I have to somehow create a textbox, a button and then I have to write code to make the search work. 
Am I missing something or does SFDataGrid not support such a feature without tweaking the UI by myself? 

SfDataGrid doesn’t have any inbuilt support to show search textbox within the DataGrid. You have to include your own textbox to search any content in the column.  
b.) Copy and paste on column level. 
- With the competitors control I enable "RowHeader" which shows an extra small column in front of every row. 
When I click this rowheader the row gets marked and CTRL+C copies the whole row (all columns). 
On the other hand - when I select a column and hit CTRL+C only the content of this column is copied. 
You can achieve this in SfDataGrid by using clipboard operations support and SelectionUnit support in SfDataGrid as shown in the following code example.  

Code example :  

<syncfusion:SfDataGrid Name="dataGrid" 
                       ShowRowHeader="True" 
                       SelectionUnit="Any" 
                       SelectionMode="Extended" 
                       GridCopyOption="CopyData" 
                       GridPasteOption="PasteData" 
                       SortClickAction="DoubleClick" 
                       Loaded="DataGrid_Loaded" 
                       ItemsSource="{Binding OrdersListDetails}"/> 
 
private void DataGrid_Loaded(object sender, RoutedEventArgs e) 
{ 
    var visualContainer = this.dataGrid.GetVisualContainer(); 
    visualContainer.MouseLeftButtonUp += visualContainer_MouseLeftButtonUp; 
} 
 
void visualContainer_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) 
{ 
    if (e.ClickCount == 1) 
    { 
        //GetVisualContainer  
        var visualContainer = this.dataGrid.GetVisualContainer(); 
        var rowcolumnIndex = visualContainer.PointToCellRowColumnIndex(e.GetPosition(visualContainer)); 
        var columnIndex = this.dataGrid.ResolveToGridVisibleColumnIndex(rowcolumnIndex.ColumnIndex); 
        if (columnIndex < 0) 
            return; 
        //Return if dataGrid is not HeaderRow 
        if (this.dataGrid.GetHeaderIndex() != rowcolumnIndex.RowIndex) 
            return; 
        var firstrowdata = this.dataGrid.GetRecordAtRowIndex(dataGrid.GetFirstRowIndex()); 
        //Get the record of LastRowIndex  
        var lastrowdata = this.dataGrid.GetRecordAtRowIndex(dataGrid.GetLastRowIndex()); 
        //Get the column of particular index 
        var column = this.dataGrid.Columns[columnIndex]; 
        if (firstrowdata == null || lastrowdata == null) 
            return; 
        //Select the column 
        this.dataGrid.SelectCells(firstrowdata, column, lastrowdata, column); 
        this.dataGrid.MoveCurrentCell(new Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex(1, rowcolumnIndex.ColumnIndex)); 
    } 
} 
 




References :  




c.) Hyperlink Text / Hyperlink URI in HyperLinkColumn 
- With the competitor a hyperlink column has a "URI" property which set's the URI (and also the text if nothing different is given).
Further there is a "HyperLinkText" property where I can bind a text - if set this is displayed in the column. 
Or: Text="[email protected]" with the URI "mailto:[email protected]
I found no information how to do this with your control but it is essential because I often use long URLs which make the column extremely wide and unreadable. 
By the way - I can make a template I know - but using a TextBlock shows a different optical representation (not blue, not underlind). And setting this value (Foreground, decoration) also doesn't work when I use different themes. 

You can achieve this by using GridHyperlinkColumn support and CurrentCellRequestNavigate event in SfDataGrid. 



Please let us know if you require further assistance from us.  

Regards, 
Mohanram A. 


Marked as answer

MA ManniAT June 2, 2021 07:29 AM UTC

Thank you for the fast answers.

About the answers:
For a - to bad since this involves a "code behind" approach.

For b - it helps a litte - at least I can choose the selectionuinit. Using this I added a combobox to let the user choose the unit.
This works whithout code behind. The only thing I don't understand is selectiounit Any. For me this looks like the Cell unit - I found no way to choos the whole row in this mode.

For c - I just found out that the column doesn't include the common Tag dependency property - but a least I get the data item in the event.
By subclassing the grid I can overvcome this an handle the event - "somehow".
Since I found no bindable property on the column I have to find a way to make this working in a more general way.
The idea was to bind the URL to the tag and use it.
But the only way I currently see is to find the column in the grid, check the binding an use the Path to get the element from my data using reflection.

Conclusion:
a - I think this can be solved using an attached property and some kind of usercontrol to search.
By the way - you shall think about this feature (Hotkey enabled search - which shows hides a row and searches).
-- How it started: I used this feature in ONE Grid because it needs to be searched often. 
-- How it's going: EVERY grid (>50) in the application has this feature enabled because the user like it so much.
b - the workaround is ok for me, although selection unit Cell plus a "select row column" would be better from the point of usability.
By the way - the double click approach to select a cell is (beside the unwanted code behind) also not working for me since I use double clicks to enter edit mode.
c - ATM I am using reflection but maybe I can find a better way to overcome the lack of a bindable property like Tag.

Thank you
Manfred


MA ManniAT June 2, 2021 08:00 AM UTC

I just found a working solution for the selection. ShowRowHeader="True" and SelectioUnit="Any" does exactly what I described with the competitors grid.


MA Mohanram Anbukkarasu Syncfusion Team June 3, 2021 11:40 AM UTC

Hi ManniAT, 

Thanks for the update.  

We are glad to know that your requirement has been accomplished. Please let us know if you require any other assistance from us.  

Regards, 
Mohanram A. 


Loader.
Up arrow icon