[Gambas-user] How to sort a TableView?

Gianluigi bagonergi at ...626...
Thu Mar 31 00:06:25 CEST 2016


Not sure if I understand the question, but something like that, could help?

If TableView1.Columns.Ascending Then
  sMySql = "SELECT *"
  sMySql &= " FROM customers"
  sMySql &= " ORDER BY surname ASC,"
  sMySql &= " name ASC"
  sMySql &= ";"
Else
  sMySql = "SELECT *"
  sMySql &= " FROM customers"
  sMySql &= " ORDER BY surname DESC,"
  sMySql &= " name DESC"
  sMySql &= ";"
Endif

Regards
Gianluigi

2016-03-30 22:18 GMT+02:00 T Lee Davidson <t.lee.davidson at ...626...>:

> The documentation for TableView shows a Sorted property which says,
> "Sorting the data is not done automatically. It must be done
> by user code." But, the page does not give any clues regarding how to
> accomplish that. Though, obviously, sorting should be done
> in the Sort event handler.
>
> In the past, I have used an array of objects to store the data represented
> in the TableView. This provided use of Object[].Sort
> with the _compare function.
>
> This time around, I am attempting to eliminate the redundancy of duplicate
> data containers (store and view) and the cumbersome
> syncing of the data and the view. (Perhaps I should just simply use a
> SQLite DB and a DataView?)
>
> There appears to be no TableView/GridView or GridView.Columns Sort method.
>
> Does anyone have any hints as to how to sort a TableView?
>
>
> --
> Lee
> __________
>
> "Artificial Intelligence is no match for natural stupidity."
>
>
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list