I reviewed your code carefully, but that would require MASSIVE rewriting of a whole module to follow that process. First, I am using a tdata / tdatabase data object format and I really want to stay with it. Please consider the following:
First I have index "pairs". The first is on all parts, and the second is on only stocking parts. These are created without a problem. In my code, I have assigned the following:
- Code: Select all Expand view
LOCAL aOrders := {{"einnum", "eindes", "einman", "einupc", "eincrs", , , "einloc" },;
{"einnums", "eindess", "einmans", "einupcs", "eincrss", , , "einlocs" } }
REDEFINE XBROWSE oLBxin ;
DATASOURCE oInventory ;
HEADERS " Part ", " Description ", " Manufacturer ", " UPC ", " Cross Ref. ", " On Hand ", " Charge ", " Location " ;
COLUMNS "invnum", "invdes", "invman", "invupc", "invcod", "invstk", "invchg", "invloc" ;
ID 716 OF oDiw ;
ON CHANGE ( oPart:load(), oDiw:update() ) ;
AUTOSORT UPDATE
oLBxin:cSortOrders := aOrders[1]
The first array are the indexes that have all parts. The second array are the indexes that have only stocking parts. They are in the proper column order. When I implement this, the program works as expected, with all columns responding in the order of the proper index. If I start it using oLBxin:cSortOrders := aOrders[2] it also works correctly, showing only the stocking parts, and allowing me to click on headers to switch indexes.
So, I figured ( from your example ) that I should be able to use a button to toggle to the alternate array. So I created the following code to toggle the two arrays.
- Code: Select all Expand view
DEFINE BUTTON oBtn3 OF oBarInv RESOURCE "FILTER" PROMPT "Filter" TOOLTIP "Filter list";
ACTION ( IIF( lAll = .T., (oLBxin:cSortOrders = aOrders[2], lAll := .F., cIAMsg := "Showing Stocking Parts Only" ), ;
( oLBxin:cSortOrders = aOrders[1], lAll := .t., cIAMsg := "Showing All Parts" ) ), ;
oLbxin:refresh(), oPart:load( ), oDiw:Update(), oSay13:refresh( ) )
So, it does not refresh the browse with the new set of arrays. Apparently there is a method I need to add to push the refresh using the new orders. The logic here: If the setting is showing all records, it substitutes the second order, does a refresh and dialog update and a couple of other things.
Can we make this work ? What am I missing ?
Thanks.