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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

UIScrollView intercepting touch events for sfDataGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

120197 Sep 10,2015 03:29 AM UTC Sep 15,2015 10:14 AM UTC Xamarin.iOS 7
loading
Tags: SfDataGrid
Michael Hoffmann
Asked On September 10, 2015 03:29 AM UTC

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

Harikrishnan N [Syncfusion]
Replied On 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


Michael Hoffmann
Replied On 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.

Harikrishnan N [Syncfusion]
Replied On 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

Michael Hoffmann
Replied On 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...

Harikrishnan N [Syncfusion]
Replied On 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


Michael Hoffmann
Replied On 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

Harikrishnan N [Syncfusion]
Replied On 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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;