Hi, Nigel --

I've never used the ColumnView (or other View) to sort the data -- I always
sort the arrays where I keep data, and then re-fill the ColumnView or other
View, if necessary.  Your question raised a point that I've never explored,
so I dug into it and found that you CAN sort data in a View, using the
built-in capabilities of the View object.  The documentation is on this
page:
http://gambasdoc.org/help/comp/gb.qt4/_columnview_columns?v3

Frankly, I sometimes find the Gambas online documentation to be a little
cryptic, so (like usual) I wrote a simple program to explore and demonstrate
sorting in a ColumnView.  Here is the essential code block, especially note
the inner/2nd "If-Endif" block:

'Note that when you change the sort of the ColumnView from one column to
another,
'the sort column header will display a down-arrow symbol.
Public Sub Button1_Click() 
  If TextBox1.Text  'In other words, if TextBox1.Text is not NULL.
    If TextBox1.Text = "0" Or If TextBox1.Text = "1" Or If TextBox1.Text =
"2" Then
      ColumnView1.Columns.Ascending = True
      ColumnView1.Columns.Sort = Val(TextBox1.Text)
    Else
      Message.Info("Type a Column ID: '0','1', or '2'", "OK")
      TextBox1.Text = ""
    Endif
  Else
    Message.Info("Type a Column ID: '0','1', or '2'", "OK")
    TextBox1.Text = ""
  Endif
End

My e-mail address is:  nicho...@acegroup.cc
If you send me your e-mail address, I'll send you a tar.gz file of the
complete program, just so you can play with it and see how the sort works. 

Best regards,

Jon Nicholson



--
View this message in context: 
http://gambas.8142.n7.nabble.com/ColumnView-Sorting-tp44263p44279.html
Sent from the gambas-user mailing list archive at Nabble.com.

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to