Sort on column header click

Post Reply
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Sort on column header click

Post by Jeff Barnes »

Hi,

I have a listbox with 8 columns ... I would like to allow the user to sort the data by clicking on a column header, how can I do this?

Thanks,
Jeff
Colin Haig
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Sort on ListBox

Post by Colin Haig »

Jeff

Use aTags

aTags := { {|| nTag := 1,HeadSort(oQuote,oLbx,nTag)},;
{|| nTag := 2,HeadSort(oQuote,oLbx,nTag)},;
{|| nTag := 3,HeadSort(oQuote,oLbx,nTag)},;
{|| nTag := 4,HeadSort(oQuote,oLbx,nTag)},;
{|| nTag := 5,'' },;
{|| nTag := 6,HeadSort(oQuote,oLbx,nTag)}}

static function HeadSort(oQuote,oLbx,nTag)
do case
case nTag == 1
oQuote:SetOrder('QUOTENO')
oQuote:Bottom()
oLbx:GoBottom()
case nTag == 2
oQuote:SetOrder('CLIENT')
oQuote:Top()
oLbx:GoTop()
case nTag == 3
oQuote:SetOrder('QDATE')
oQuote:Top()
case nTag == 4
oQuote:SetOrder('CONTACT')
oQuote:Top()
case nTag == 6
oQuote:SetOrder('PROJECT')
oQuote:Top()
endcase
oLbx:Refresh()
oLbx:SetFocus()
return(nil)
//------------------------------------------------------------------------------//

Hope this helps

Cheers

Colin
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Post by Jeff Barnes »

Thanks Colin,

That pointed me in the right direction :-)


Jeff
Post Reply