We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Scrolling to Searched text row

I am trying to scroll into view the row which contains the data on which I am searching. For some reason the row does not come into view when I move to the current cell - it scrolls the rows but does not display the row with the searched in text.

        myGrid.SearchController.SearchColumns.Add("Description")
        myGrid.SearchController.Search(Search.Text)
        myGrid.SearchController.FindNext(Search.Text)
        Dim temp As Syncfusion.WinForms.GridCommon.ScrollAxis.RowColumnIndex = myGrid.SearchController.CurrentRowColumnIndex
        temp.RowIndex += 2
        temp.ColumnIndex = 1
        myGrid.MoveToCurrentCell(temp)
        temp.RowIndex -= 2
        myGrid.MoveToCurrentCell(temp)

As you can see from my code the workaround is to move beyond the row containing the searched text then moving back to the required row. This obviously will not work if the text being searched for is the last row in the grid.

8 Replies

SA Saravanan Ayyanar Syncfusion Team January 27, 2020 11:37 AM UTC

Hi Peter Rutterford, 
 
Thank you for using Syncfusion controls. 
 
We have checked your provided code example. We suspect that, your requirement is that current cell have to move  based on the Find Next Search text. You can achieve this by using the SfDataGrid.SearchController.CurrentRowColumnIndex property. Please refer the below code snippet.   
 
AddHandler button1.Click, AddressOf button1_Click 
 
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click 
                Me.sfDataGrid1.SearchController.SearchColumns.Add("ProductName") 
                Me.sfDataGrid1.SearchController.Search(textBox1.Text) 
                Me.sfDataGrid1.SearchController.FindNext(textBox1.Text) 
                Me.sfDataGrid1.MoveToCurrentCell(Me.sfDataGrid1.SearchController.CurrentRowColumnIndex) 
End Sub 
 
Sample Link: 
 
UG Link: 
 
If we have misunderstood your requirement, please provide more information regarding the requirement. This would help us to proceed further. 
 
Regards, 
Saravanan A. 



PR Peter Rutterford January 27, 2020 04:42 PM UTC

Thanks for your reply. I have tried your suggestion and also

        myGrid.TableControl.ScrollRows.ScrollInView(myGrid.SearchController.CurrentRowColumnIndex.RowIndex)
        myGrid.TableControl.UpdateScrollBars()

This does not scroll into view correctly either. It may work on the first text search and possibly the second but fails to bring it into view afterwards for any other occurrences. I do not know if it is relevant but I have text wrapping on the column being searched and use

    Private Sub MatsListGrid_QueryRowHeight(ByVal sender As Object, ByVal e As QueryRowHeightEventArgs) Handles myGrid.QueryRowHeight
        Dim autoFitOptions As New RowAutoFitOptions()
        'To get the calculated height from GetAutoRowHeight method.
        Dim autoHeight As Integer

        If myGrid.AutoSizeController.GetAutoRowHeight(e.RowIndex, autoFitOptions, autoHeight) Then
            If autoHeight > 24 Then
                e.Height = autoHeight
                e.Handled = True
            End If
        End If

    End Sub

to adjust the height of the row.

The search works perfectly in that it finds all occurrences of the text being searched, it just does not display them all in view.


SA Saravanan Ayyanar Syncfusion Team January 28, 2020 01:59 PM UTC

Hi Peter Rutterford, 
 
Thank you for your update. 
 
We can replicate the reported issue and created the bug report for the same. Can you please specify your current Syncfusion version so that We will provide a patch for that version.  
 
Regards, 
Saravanan A. 



PR Peter Rutterford January 28, 2020 04:02 PM UTC

Hi Saravan

Thanks for your reply. I am pleased you have managed to replicate the issue. The version I experienced it in was 17.4.0.39.

Thanks.

Peter



SA Saravanan Ayyanar Syncfusion Team January 29, 2020 01:46 PM UTC

Hi Peter Rutterford, 
 
Thank you for your update. 
 
We can replicate the reported issue “Searched text is not displayed in view while clicking on FindNext button two or more time” on our end and created bug report for the same. 
 
We will fix the reported issue and provide the patch for this issue in your version 17.4.0.39 on February 12th, 2020. 
 
You can track the status of this report through the following feedback link, 
 
Feedback Link:  
     
We appreciate your patience until then. 
 
Regards, 
Saravanan A. 



SS Susmitha Sundar Syncfusion Team February 12, 2020 04:09 PM UTC

Hi Peter, 
 
 
We have fixed the issue “Searched text is not displayed in view while clicking on FindNext button two or more time and you can download the patch from following location.  
  v17.4.0.39 
Recommended approach – exe will perform automatic configuration       
Please find the patch setup here:   
  
               
Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment                        
Please find the patch assemblies alone from:  
 
Please find the Nugets from the below location:      
 
  
Assembly Version: 17.4.0.39 
Installation Directions:  
This patch should replace the files “Syncfusion.SfDataGrid.WinForms” under the following folder.  
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\4.0  
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\17.4.0.39 
\precompiledassemblies\17.4.0.39 
\4.0  
   
To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you will have to manually copy and paste them to the preferred location, or you will have to run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.  
   
Note 
To change how you receive bug fixes, ask your license management portal admin to change your project’s patch delivery mode.  
   
   
Disclaimer:  
If you have received other patches for the same version for other products, please apply all patches in the order received. Please note that we have created this patch for version 17.4.0.39 
specifically, to resolve the following issue reported in the forum 150961. This fix will be included in our Volume 1 release which is expected on end of March 2020.  
 
Regards, 
Susmitha S 



PR Peter Rutterford February 12, 2020 10:26 PM UTC

Hi Susmitha S

I have installed the patch and it works perfectly. Your service is excellent.

Thank you very much.

Regards

Peter


FP Farjana Parveen Ayubb Syncfusion Team February 13, 2020 05:33 AM UTC

 
Hi Peter 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Farjana Parveen A 


Loader.
Live Chat Icon For mobile
Up arrow icon