Datagrid Sorting Problem on Mobile

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Datagrid Sorting Problem on Mobile

bilbosax
I am able to connect to my services on my mobile device and retrieve data from a remote database.  I now have it displaying in a spark datagrid.  I want the user to be able to sort the columns by clicking on the headers.  It works great on the desktop.  But on a mobile device, only the first five columns are sortable.  When I tap any of the other headers, nothing happens.  This is true using the built in sorting, and also a custom sorting method.  I am baffled.  I have added nothing that would block or hinder the sorting, and it works on the desktop and in the mobile simulator, but not on the device.

Any thoughts why this would happen? Does an mx datagrid work better on mobile?
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid Sorting Problem on Mobile

OmPrakash Muppirala
Did you try running it in debug mode?  Most likely a exception occurred.

Thanks,
Om

On Tue, Oct 18, 2016 at 5:48 PM, bilbosax <[hidden email]> wrote:

> I am able to connect to my services on my mobile device and retrieve data
> from a remote database.  I now have it displaying in a spark datagrid.  I
> want the user to be able to sort the columns by clicking on the headers.
> It
> works great on the desktop.  But on a mobile device, only the first five
> columns are sortable.  When I tap any of the other headers, nothing
> happens.
> This is true using the built in sorting, and also a custom sorting method.
> I am baffled.  I have added nothing that would block or hinder the sorting,
> and it works on the desktop and in the mobile simulator, but not on the
> device.
>
> Any thoughts why this would happen? Does an mx datagrid work better on
> mobile?
>
>
>
> --
> View this message in context: http://apache-flex-users.
> 2333346.n4.nabble.com/Datagrid-Sorting-Problem-on-Mobile-tp13844.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid Sorting Problem on Mobile

bilbosax
When I run it in debug mode in the simulator, no exception is thrown and it sorts as it should.  Is there a way to debug on the device to see if an exception has been thrown? (Device is an iPad)

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid Sorting Problem on Mobile

OmPrakash Muppirala
You connect the USB cable and run it on Debug mode on the device itself.

This link would help:
http://help.adobe.com/en_US/flex/mobileapps/WSa8161994b114d624-33657d5912b7ab2d73b-7fe5.html#WSe4e4b720da9dedb5-2d82208b12e46a72ded-7ffc

The only change is that you dont need to involve iTunes anymore.

Thanks,
Om

On Tue, Oct 18, 2016 at 5:59 PM, bilbosax <[hidden email]> wrote:

> When I run it in debug mode in the simulator, no exception is thrown and it
> sorts as it should.  Is there a way to debug on the device to see if an
> exception has been thrown? (Device is an iPad)
>
> Thanks
>
>
>
> --
> View this message in context: http://apache-flex-users.
> 2333346.n4.nabble.com/Datagrid-Sorting-Problem-on-
> Mobile-tp13844p13846.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid Sorting Problem on Mobile

bilbosax
I do get an error being thrown, but long before any actual sorting, so I don't know if it is having an effect on the sorting or not.  The error is as follows:

Error #2044: Unhandled ErrorEvent:. text=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

When I google it, I see a lot of references to descriptor file information that you provided to me earlier regarding the network connection on mobile devices.  The iPad info that I added to my descriptor is as follows: (I notice that Flash Builder called the opening tag iPhone, I don't know if I should change it to iPad???)

    <iPhone>
        <InfoAdditions>
<![CDATA[
			<key>UIDeviceFamily</key>
			<array>
				<string>2</string>
			</array>
			
			<key>NSAppTransportSecurity</key>
			<dict>
				<key>NSExceptionDomains</key>
				<dict>
					<key>www.billspencere.com</key>
					<dict>
						<!--Include to allow subdomains-->
						<key>NSIncludesSubdomains</key>
						<true/>
						<!--Include to allow HTTP requests-->
						<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
						<true/>
						<!--Include to specify minimum TLS version-->
						<key>NSTemporaryExceptionMinimumTLSVersion</key>
						<string>TLSv1.1</string>
					</dict>
				</dict>
			</dict>
		]]>
</InfoAdditions>
        <requestedDisplayResolution>high</requestedDisplayResolution>
    </iPhone>
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid Sorting Problem on Mobile

bilbosax
I think that I am getting this error because the database is just a test database on an unsecure website server and it is not a secure connection.  I handled it by changing some of the Apple Transport Security settings in my descriptor file and the problem is gone.

But I am getting no exceptions thrown when I try to sort, it simply does nothing at all unless it is one of the first five columns.  I am not even sure where to start looking.  If the program doesn't complain, how do you solve the problem?
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid Sorting Problem on Mobile

bilbosax
OK, so it just got really interesting.  I have 35 columns of data that have to be displayed, which is too much to fit on the screen.  So I put about 12 columns on the screen at a time, and then use a "previous" or "next" button to change the visibility of the columns that I want to display.  So essentially, I have 3 pages of columns that a user can look at.  On all 3 pages, I am seeing the exact same thing.  Anything left of the midline of the iPad is sortable.  If you click a header to the right of the front facing camera, nothing.  There are some columns that stradle the camera line.  If you click that header to the left of the camera line, that column is sortable, but if you click the same header on the right side of the camera line, it is not sortable.  So it is happening straight down the middle of the iPad.  SURELY, there is nothing that I am doing to cause this, is there?

Anything else you think I should try?  Though I don't want to because I have put so much work into it and like the way fonts look in the spark datagrid, I am thinking of trying the mx datagrid.
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid Sorting Problem on Mobile

Josh Tynjala
You could listen for mouse/touch events on the DataGrid (or maybe the
stage) and check the target property of the event. It might give you a clue
what is actually being touched. It could be that something unexpected (and
invisible) is blocking it.

- Josh

On Oct 18, 2016 7:51 PM, "bilbosax" <[hidden email]> wrote:

> OK, so it just got really interesting.  I have 35 columns of data that have
> to be displayed, which is too much to fit on the screen.  So I put about 12
> columns on the screen at a time, and then use a "previous" or "next" button
> to change the visibility of the columns that I want to display.  So
> essentially, I have 3 pages of columns that a user can look at.  On all 3
> pages, I am seeing the exact same thing.  Anything left of the midline of
> the iPad is sortable.  If you click a header to the right of the front
> facing camera, nothing.  There are some columns that stradle the camera
> line.  If you click that header to the left of the camera line, that column
> is sortable, but if you click the same header on the right side of the
> camera line, it is not sortable.  So it is happening straight down the
> middle of the iPad.  SURELY, there is nothing that I am doing to cause
> this,
> is there?
>
> Anything else you think I should try?  Though I don't want to because I
> have
> put so much work into it and like the way fonts look in the spark datagrid,
> I am thinking of trying the mx datagrid.
>
>
>
> --
> View this message in context: http://apache-flex-users.
> 2333346.n4.nabble.com/Datagrid-Sorting-Problem-on-
> Mobile-tp13844p13850.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid Sorting Problem on Mobile

OmPrakash Muppirala
In reply to this post by bilbosax
On Oct 18, 2016 7:51 PM, "bilbosax" <[hidden email]> wrote:
>
> OK, so it just got really interesting.  I have 35 columns of data that
have
> to be displayed, which is too much to fit on the screen.  So I put about
12
> columns on the screen at a time, and then use a "previous" or "next"
button
> to change the visibility of the columns that I want to display.  So
> essentially, I have 3 pages of columns that a user can look at.  On all 3
> pages, I am seeing the exact same thing.  Anything left of the midline of
> the iPad is sortable.  If you click a header to the right of the front
> facing camera, nothing.  There are some columns that stradle the camera
> line.  If you click that header to the left of the camera line, that
column
> is sortable, but if you click the same header on the right side of the
> camera line, it is not sortable.  So it is happening straight down the
> middle of the iPad.  SURELY, there is nothing that I am doing to cause
this,
> is there?
>
> Anything else you think I should try?  Though I don't want to because I
have
> put so much work into it and like the way fonts look in the spark
datagrid,
> I am thinking of trying the mx datagrid.
>
>

Try using a custom sort function for the problematic columns and put a
breakpointi in it.   That should give you some clues.

Thanks,
Om

>
> --
> View this message in context:
http://apache-flex-users.2333346.n4.nabble.com/Datagrid-Sorting-Problem-on-Mobile-tp13844p13850.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid Sorting Problem on Mobile

Fréderic Cox
In reply to this post by bilbosax
I'm having the exact same issue and it is driving me nuts! For me it is the first 4 columns that are working but the others are not. Did you ever find a solution to this problem?
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid Sorting Problem on Mobile

Fréderic Cox
In reply to this post by bilbosax
bilbosax wrote
 So it is happening straight down the middle of the iPad.  SURELY, there is nothing that I am doing to cause this, is there?
Thanks for this info, it is very valuable. It got me to the cause of the problem. The problem is in spark.components.GridColumnHeaderGroup, in there is a function mouseEventHeaderView which is called to determine which column was touched. In there a function containsMouseEvent is called on the spark.components.gridClasses/GridColumnHeaderView. In that function we find the following code:

 public function containsMouseEvent(event:MouseEvent):Boolean
    {
        const eventStageX:Number = event.stageX;
        const eventStageY:Number = event.stageY;
        const origin:Point = localToGlobal(zeroPoint);

        origin.x += horizontalScrollPosition;
        if (layoutDirection == LayoutDirection.RTL)
            origin.x -= width;

        origin.y += verticalScrollPosition;
       
        return (eventStageX >= origin.x) && (eventStageY >= origin.y) &&
            (eventStageX < (origin.x + width)) && (eventStageY < (origin.y + height));
    }  

The problem is that width is half the size as it should be. Now I am trying to find the cause why this is an incorrect value and hope I find a fix. Any help appreciated!

Reply | Threaded
Open this post in threaded view
|

Re: Datagrid Sorting Problem on Mobile

Fréderic Cox
Ok I managed to find a workaround and got it working. What I did was
monkeypatch spark.components.gridClasses/GridColumnHeaderView and then
changed the code to

public static var dpiScaleFactor:Number = 1;

    public function containsMouseEvent(event:MouseEvent):Boolean

    {

        const eventStageX:Number = event.stageX;

        const eventStageY:Number = event.stageY;

        const origin:Point = localToGlobal(zeroPoint);


        origin.x += horizontalScrollPosition;

        if (layoutDirection == LayoutDirection.RTL)

            origin.x -= width;


        origin.y += verticalScrollPosition;



        return (eventStageX >= origin.x) && (eventStageY >= origin.y) &&

            (eventStageX < (origin.x + (width*dpiScaleFactor))) &&
(eventStageY < (origin.y + height));

    }


and in my application on preinitialize I do

GridColumnHeaderView.dpiScaleFactor = (runtimeDPI/applicationDPI);


This is working fine for me on the device now and fixes the issue, but I'm
sure someone with a deeper knowledge of the SDK can take a look for a
better fix?

On Fri, Jun 2, 2017 at 5:25 PM, Fréderic Cox <[hidden email]> wrote:

> bilbosax wrote
> >  So it is happening straight down the middle of the iPad.  SURELY, there
> > is nothing that I am doing to cause this, is there?
>
> Thanks for this info, it is very valuable. It got me to the cause of the
> problem. The problem is in spark.components.GridColumnHeaderGroup, in
> there
> is a function mouseEventHeaderView which is called to determine which
> column
> was touched. In there a function containsMouseEvent is called on the
> spark.components.gridClasses/GridColumnHeaderView. In that function we
> find
> the following code:
>
>  public function containsMouseEvent(event:MouseEvent):Boolean
>     {
>         const eventStageX:Number = event.stageX;
>         const eventStageY:Number = event.stageY;
>         const origin:Point = localToGlobal(zeroPoint);
>
>         origin.x += horizontalScrollPosition;
>         if (layoutDirection == LayoutDirection.RTL)
>             origin.x -= width;
>
>         origin.y += verticalScrollPosition;
>
>         return (eventStageX >= origin.x) && (eventStageY >= origin.y) &&
>             (eventStageX < (origin.x + width)) && (eventStageY < (origin.y
> +
> height));
>     }
>
> The problem is that width is half the size as it should be. Now I am trying
> to find the cause why this is an incorrect value and hope I find a fix. Any
> help appreciated!
>
>
>
>
>
> --
> View this message in context: http://apache-flex-users.
> 2333346.n4.nabble.com/Datagrid-Sorting-Problem-on-
> Mobile-tp13844p15280.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>