Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting grid on Click header
Message
From
05/04/2020 09:26:37
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
 
 
To
05/04/2020 01:23:46
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01673953
Message ID:
01673958
Views:
49
>Hello community,
>
>I see a Post by Yousfy for creating BINDEVENT on grid INIT to sortign grid on header click.
>I try to change the same for my grid form, but i always received this error "Table has no index order set.", i don´t understand why.
>This is my code :
>
>
>Public oHandler
>oHandler = Newobject( "myhandler" )
>Bindevent(PDU_FCTEXM.Pageframe1.Udcpage3.Grid1,"Init",oHandler,"mygridinit",1)
>
>For i=1 To PDU_FCTEXM.Pageframe1.Udcpage3.Grid1.ColumnCount
>	If Inlist(i,1,2,3,4,5,6,7,8,9,10,11)  &&choice only the column to sort asc/descending-grid can have any columnCount
>		aa="PDU_FCTEXM.Pageframe1.Udcpage3.Grid1.column"+Trans(i)+".header1"
>		Bindevent(&aa,"click",oHandler,"mygridinit",1)
>	Endif
>Endfor
>
>
>Define Class myhandler As Session
>	Procedure mygridinit
>	x=Sys(1270)
>	N=val(right(allt(x.name),1))
>
>	Select myBolistex
>	If Val(Sys(21))<>N  && current index number
>		Set Order To N In myBolistex
>	Else
>		If Descending(N,"myBolistex")
>			Set Order To N In myBolistex Ascending
>
>		Else
>			Set Order To N In myBolistex Descending
>
>		Endif
>	ENDIF
>	
>	Go Top In myBolistex
>	PDU_FCTEXM.Pageframe1.Udcpage3.Grid1.Refresh
>	PDU_FCTEXM.Pageframe1.Udcpage3.Grid1.SetFocus
>	Endproc
>
>Enddefine
>
>
>someone could give me the reason for that error.

Is it possible that N is sometimes greater than the number of index tags on your cursor? I tried to
set order to 5
on a table with 3 tags and got the same error.

Hello Dragan

Many thanks for your reply,

I use the thread on https://www.foxite.com/archives/sorting-the-grid-by-header-clicking-0000232130.htm to try to adapt on my deployment.

I did some tests with these below:
x=Sys(1270)
messagebox(x) && the result are column8
N=val(right(allt(x.name),1))
messagebox(N) && return the value 8,0000000
in the 2 messagebox, the return values are float, then i make this :
N=TRAN(val(right(allt(x.name),1)),"9")
The result value appear 8, but i receive always the same error.

finally, i have put another messagebox to debug one ore time to see if i click on my column
>Define Class myhandler As Session
>	Procedure mygridinit
       messagebox("ok, i click onthe header")
After clicking on one of the headers columns define on my INLIST, the message appear.
my Cursor have fields type char,boolean,memo and numeric, i don´t know if some of theses fields type are supported ?

Sincerely, i don´t understand why this error occurs, maybe the value passed inside
If Val(Sys(21))<>N
are not correct?

I hope you could give me some help to understand why this code don´t work.

Best regards,
Luis
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform