If you are not going to sort at db level, you can use a simple wrapper
around the array and bind datagridview to that wrapper. Take a look at this:
http://www.timvw.be/presenting-the-sortablebindinglistt/

On Fri, Jun 26, 2009 at 8:46 AM, Alex Bibiano <[email protected]> wrote:

>
> Thanks for the response, but this is not what I'm looking for.
>
> Currently, all the find methods from ActiveRecord classes returns
> arrays (arrays of my class), but this arrays don't implement the
> required interfaces (IBindingList) to use it as datasource in a
> datagridview and enable column sorting by clicking on the header.
>
> Now I'm using the returned array by find(), to populate a datatable
> and use it as datasource for the datagridview, but I'm sure it's not
> the best solution.
>
> Thanks,
>
> Alex B.
>
> On Jun 19, 2:20 pm, Mauricio Scheffer <[email protected]>
> wrote:
> > ActiveRecordMediator<T> comes with these static methods that allow
> > defining ordering and return an array of objects:
> >
> > public static T[] FindAll(Order[] orders, params ICriterion[]
> > criterias)
> > public static T[] FindAll(DetachedCriteria detachedCriteria, params
> > Order[] orders)
> > public static T[] SlicedFindAll(int firstResult, int maxResults, Order
> > [] orders, params ICriterion[] criterias)
> > public static T[] SlicedFindAll(int firstResult, int maxResults,
> > DetachedCriteria criteria, params Order[] orders)
> >
> > On Jun 19, 7:24 am,AlexBibiano<[email protected]> wrote:
> >
> > > Hi folk,
> >
> > > What’s the best approach to get a list of sortable activerecord
> > > objects?
> >
> > > I have a Person class and want to bind the FindAll() result (it’s an
> > > array of Persons) to a datagridview and enable the user to sort the
> > > grid clicking the column header.
> >
> > > Thanks,
> >
> > >AlexB.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to