Hi,
I am evaluating the Infragistics Grid View control.
There is one functionality that we need and seems to be lacking, which is to allow user to click on a column to perform sorting. The column header also need to indicate the current sort order (a up/down arrow, for example). Also, Data Source Helper cannot be used in my case because the number of columns is dynamic so it cannot simply be represented by properties of object.
I have browsed through the documentation and did not seem to find any clue.
Is it possible to achieve my need with the Grid View control?
Thank you.
Hi!
Since the grid is fully customizable, you can basically do anything you'd like. In this case, you'll want to create your own IGGridViewHeaderCell, and add a UITapGesture so that you can listen for sorting.
If you were using the DSH, you could get the sorting part for free, but since you're not, you'll have to sort your data accordingly.
On a side note, even though your columns are dynamic, i'd still recommend following the DataSourceHelper approach, and even use the same constructs.
If you could describe your how your data model is going to work, i can put together a sample for you that would help you get started.
-SteveZ
Hi Stephen,
Thanks for the response.
I can see that using IGGridViewHeaderCell along with gesture recognizers would work with handling tapping on a column header. But is changing the appearance of a header cell to indicate sort order possible upon tapping it?
In our case, we are trying to display cross tab data of date range as the grid columns, so the ranges are unknown in number.
If you can show some sample code it would be very helpful.
So yea, you would just create a custom header cell, and you would control any visuals you put inside them.
So for your data, it sounds like your rows are a fixed number then? If so, it kind of sounds like you're just transposing the rows and columns?
http://www.infragistics.com/community/blogs/baldnbearded/archive/2014/01/13/iggridview-using-a-custom-datasource-helper-to-swap-rows-and-columns.aspx
My rows are not fixed number, the number of date range changes depend on the the start and end date of my data. As my data grows, the start and end date also changes.
So I created a sample that shows how to create a custom header cell, and pass the tap back to your datasource.
It's a very basic sample, and doesn't show sorting, as I didn't want to presume anything about your data.
If you have any questions, let me know!