xBrowse ascending order

xBrowse ascending order

Postby Otto » Wed Aug 07, 2013 6:44 pm

xBrowse
I can’t remember how to fix XBrowse on ascending order when clicking on Header.
Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse ascending order

Postby nageswaragunupudi » Thu Aug 08, 2013 2:10 am

When we click on header of an unsorted column, it will be sorted in Ascending Order. If we click again on the header of a sorted column, the order keeps toggling between ascending and descending.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse ascending order

Postby ShumingWang » Thu Aug 08, 2013 3:59 am

oCol := obrow1:AddCol()
oCol:bStrData := {||odb1:startdate}
oCol:cHeader := "创建日期"

oCol:cOrder := "A"
oCol:nHeadBmpNo := 1
oCol:bLClickHeader := {|r,c,f,o| ::bas1205( r,c,o) }

...


method bas1205(nrow,ncol,oCol) class bas12class

local aCols,cOrder,nFor,nLen
local nat,id1
aCols := oCol:oBrw:aCols
cOrder := oCol:cOrder
nAt := oCol:nCreationOrder
nLen := LEN(aCols)

for nFor := 1 to nLen
aCols[ nFor ]:nHeadBmpNo := 0
aCols[ nFor ]:cOrder := ""
next

do case
case nAt==1
id1:=::odb1:custid
::odb1:cQuery:="select * from custm1 order by custid"+if(corder=="A"," desc","")
::odb1:refresh()
::obrow:refresh()
::obrow:bseek:={|v|::odb1:SEEK(v,,{||::odb1:custid})}
::obrow:SEEK(id1)
case nAt==3
id1:=::odb1:custm
::odb1:cQuery:="select * from custm1 order by custm"+if(corder=="A"," desc","")
::odb1:refresh()
::obrow:refresh()
::obrow:bseek:={|v|::odb1:SEEK(v,,{||::odb1:custm})}
::obrow:SEEK(id1)
case nAt==5
id1:=::odb1:sales
::odb1:cQuery:="select * from custm1 order by sales"+if(corder=="A"," desc","")
::odb1:refresh()
::obrow:refresh()
::obrow:bseek:={|v|::odb1:SEEK(v,,{||::odb1:sales})}
::obrow:SEEK(id1)
case nAt==6
id1:=::odb1:addrc
::odb1:cQuery:="select * from custm1 order by addrc"+if(corder=="A"," desc","")
::odb1:refresh(.t.)
::obrow:refresh()
::obrow:bseek:={|v|::odb1:SEEK(v,,{||::odb1:addrc})}
::obrow:SEEK(id1)
endcase
if nat==1.or.nat==3.or.nat==5.or.nat==6
if cOrder == "" .or. cOrder == "D"
oCol:cOrder := "A"
oCol:nHeadBmpNo := 1
else
oCol:cOrder := "D"
oCol:nHeadBmpNo := 2
endif
end


return
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Re: xBrowse ascending order

Postby Otto » Thu Aug 08, 2013 5:51 am

Thank you for your help.

Mr. Rao is it possible to switch off toggling.
Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse ascending order

Postby nageswaragunupudi » Thu Aug 08, 2013 6:22 am

Mr Otto

We have not provided for disabling toggling.
Do you want to disable toggling globally for the entire project or for selected browses only?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse ascending order

Postby Rick Lipkin » Thu Aug 08, 2013 12:36 pm

Otto

I believe you can just omit AUTOSORT when you create your browse ... if I recall that disables the header click to sort.

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse ascending order

Postby nageswaragunupudi » Thu Aug 08, 2013 1:50 pm

Mr Rick

He wants autosort.
What he does not want is descending sort.
I shall help when he explains to me whether he wants to suppress Descending sort globally or for selected browses. i shall think of introducing a switch for that purpose.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse ascending order

Postby Otto » Fri Aug 09, 2013 7:40 am

Dear Mr. Rao,
to suppress toggling for a single browser would be fine for me.
Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse ascending order

Postby nageswaragunupudi » Sun Aug 11, 2013 5:09 am

Mr Otto

Please introduce new DATA by adding this line in the class declaration section of xbrowse.prg

Code: Select all  Expand view
DATA lSortDescend AS LOGICAL INIT .t.
 

Desirable position is next to DATA lAutoSort.

In the METHOD SetOrder CLASS TXBrwColumn, insert these three lines of code just after local declaration:
Code: Select all  Expand view
  if ::cOrder == 'A' .and. ! ::oBrw:lSortDescend
      return .f.
   endif
 

For whichever browse, you do not want descend sort, please set
oBrw:lSortDescend := .f.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 114 guests