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

UIScrollView intercepting touch events for sfDataGrid

Hello,

I'm currently evaluating the SF tools, specifically the DataGrid. I like the functionality so far, however I'm running into a stumbling block that isn't really the fault of SF, but maybe you can help me with the right work-around:

It's a known problem when embedding views within UIScrollView that touch events and/or gestures aren't properly passed through. This can be worked around with a number of measures, however I don't know which ones will work with the sfDataGrid!

The UIScrollView setup is a pure horizontal one, and only 2 pages at that. The second page is the data grid. All row selection and scrolling within that occurs programmatically, but a touch/tap gesture will bring up a pop-up with additional info on the selected row. The information in this grid controls graphical information on the first page of the scroll view.

For testing purposes I don't care if for now all taps/single touches go through so I can familiarise myself with other features of the data grid (sorting on column tap, etc). Vertical scroll movements for the data grid (while horizontal ones continue to cause paging) could come in handy, but isn't a must.

Is there a recommended way to do this without having to wade into some nasty sub-classing of the sfDataGrid?

Thanks!
Mike

10 Replies

HN Harikrishnan N Syncfusion Team September 10, 2015 12:39 PM UTC

Hi Michael,

Thank you for using Syncfusion Products.

We have analyzed your query. We have internally handled the tap gesture for the GridCells to process selection and since you have mentioned that row selection and scrolling within the DataGrid in your second page occurs without any problem, you can achieve your requirement of bringing up a pop-up while selecting a row by handling the DataGrid’s SelectionChanging or SelectionChanged event. You will get the DataGrid as sender and selected items in the argument. Hence, you can show a pop from there with the additional information you need to display. Moreover if you wish to do some other actions instead of selection while tapping a row, then you can do your actions in the SelectionChanging event and return the e.Cancel as true. For your reference, we have prepared a simple sample which skips selection for the first row and displays the RowIndex of the other rows in an UIAlertView upon selecting it. You can download the sample from the below link:

Sample link: http://www.syncfusion.com/downloads/support/forum/120197/ze/SelectionSample-666014937

If your requirement differs from this, please revert with the modified sample based on your application with your requirements in detail.

For sorting the columns you need to set the DataGrid.AllowSorting property to True. Then, on tapping the column header you can sort the column in ascending, descending or to the original order. To know about the features and getting started of DataGrid, please refer the below link:

http://docs.syncfusion.com/xamarin/essential-datagrid/getting-started

Regarding you requirement of Horizontal scroll movements continuing to cause paging, this cannot be done as horizontal movement scrolls the grid to scroll horizontally.

Please let us know if this helps.

Regards,
Harikrishnan



MH Michael Hoffmann September 10, 2015 08:34 PM UTC

Hello,

Thanks for your reply, but I think there is some confusion here:

The datagrid is NOT seeing touch/trap events and selection is NOT working!

The cause being the UIScrollView intercepting all events to the datagrad and not passing them through.

The popup was simply my final goal, for now I'd be happy just to see the "normal" selection events being handled.


HN Harikrishnan N Syncfusion Team September 11, 2015 02:40 PM UTC

Hi Micheal,

We tried loading the SfDataGrid inside a UIScrollView as per your requirements and we got the grid scrolling and handling selection correctly. The grid rows got selected and we have achieved your requirement in that sample. We have attached the analyzed sample for your reference. You can download the sample from the below location:

http://www.syncfusion.com/downloads/support/forum/120197/ze/SelectionSample647295312

In case if your requirements differ from this, please revert to us with the sample with which you tried. On analyzing your issue we come across these links from StackOverflow which might be useful for you.

http://stackoverflow.com/questions/11485100/allow-uiscrollview-and-its-subviews-to-both-respond-to-a-touch
http://stackoverflow.com/questions/11947797/uiscrollview-sending-touches-to-subviews

Please let us know if this helps.

Regards,
Harikrishnan


MH Michael Hoffmann September 14, 2015 02:51 AM UTC

Hello!

Thanks for the sample code. It works well, but when I tried to integrate it with my own and for some reason or the other it still won't let the events through.

I'm familiar with the Stackexchange links and have tried the various suggestions therein. So far without luck.

As the sample code you sent me works fine until I extract it to my own, I'm now trying to hunt down where my issue could be.

Frustrating and confusing...


HN Harikrishnan N Syncfusion Team September 14, 2015 07:34 AM UTC

Hi Micheal,

Since this issue is occurring only at your end, could you please share your sample or some details like what you are doing in your application? We cannot help you further without knowing these details and also please make sure you have set the SelectionMode property of the DataGrid. Selection in the DataGrid takes place based on this property only. The default value of this property is None, hence no selection will occur by default. 

Please let us know if you have any query. 

Regards,
Harikrishnan



MH Michael Hoffmann September 15, 2015 12:10 AM UTC

Thank you, Harikrishnan!

As I didn't want to post the source code publicly here, I've sent it as an Incident. I trust you'll be able to access it.

Regards!
Mike


HN Harikrishnan N Syncfusion Team September 15, 2015 10:14 AM UTC

Hi Micheal,

Thanks for your reply. We are able to run your sample, we will check about this and update the response in the incident.

Regards,
Harikrishnan



JO Jonathan May 24, 2019 10:23 PM UTC

I am also experiencing this issue with my Xamarin Forms project. The SFDataGrid goes into this mode where even if you just touch directly down on the screen, the scrollbars show up and it doesn't let you select any rows. Was there ever any resolution to this?

Update: By setting the SfDataGrid VerticalOverScrollMode="Bounce" this seems to address the problem.


SP Subburaj Pandian Veluchamy Syncfusion Team May 27, 2019 02:24 PM UTC

Hi Jonathan, 
   
Currently, we are analyzing the reported query with DataGrid. We will validate and update you further details in one business day (May 28, 2019). We appreciate your patience until then. 
 
Regards,
Subburaj Pandian V       



SP Subburaj Pandian Veluchamy Syncfusion Team May 28, 2019 12:17 PM UTC

Hi Jonathan,  
   
Thank you for your patience. 

We have checked your query with DataGrid scrolling in Xamarin.Forms, based on the scrolling mode grid will scroll. As checking when scrolling grid, can be able to select rows and scrolls as expected from our end. As you mentioned, when setting scroll mode as bounce, resolves the issue. Bounce mode is to give bounce effect in the data grid.  

We have tested this scenario with the attached sample - link
 
Please check the sample and let us know, if you’re still facing the same issue? If so, please share more information about the query with issue replicating video (if possible)? Since the share information is not enough to understand your query clearly. It will be helpful for us to check on it and provide you the solution. 
 
Regards,
Subburaj Pandian V      


Loader.
Up arrow icon