|
| Change Table Column order programatically |
| Iniciado por guest, 02,mar. 2016 00:14 - 3 respuestas |
| |
| | | |
|
| |
| Publicado el 02,marzo 2016 - 00:14 |
Hi
I am unable to find a ay top programatically change th border of table columns.
My clients want to be able to have the columns of a table in different order depending on use\user.
eg table has columns = ID, code,Name ,qty, Price, etc another user wants ID, qty, code,Name , Price, etc I am required to have some code ( e.g.: attached to a button) that changes the column order and redisplays the table. It is easy to change column titles etc, but no option for the position.
Dragging columns is becoming frustration for my users. Some columns contain controls etc so complex to apply all the parts to each column from scratch, but maybe could it be done that way.
Any help appreciated
Mark |
| |
| |
| | | |
|
| | |
| |
| Publicado el 02,marzo 2016 - 07:13 |
Hi Mark,
TableMoveColumn(..) is your friend !
It's mandatory to sum up the anchoring of all of the Table columns to 100%
In order to restore the Table control to its original configuration just use my ResetColumnConfiguration()
TC,TX, TW, TD are int PopName is string = PopupField() TN is string TC = TableCount(PopName,toColumn) FOR TX = 1 TO TC TN = TableEnumColumn(PopName,TX) TableMoveColumn(PopName,TN,TX) IF {PopName+"."+TN,indControl}..InitialVisible = False THEN {PopName+"."+TN,indControl}..Visible = False ELSE {PopName+"."+TN,indControl}..Visible = True END END FOR TX = 1 TO TC TN = TableEnumColumn(PopName,TX) {PopName+"."+TN,indControl}..Width = {PopName+"."+TN,indControl}..InitialWidth IF {PopName+"."+TN,indControl}..Visible = True THEN TW += {PopName+"."+TN,indControl}..Width END END TD = {PopName,indControl}..Width - TW - 18 // 18 ~= Width of vertical scrollbar of Table FOR TX = 1 TO TC TN = TableEnumColumn(PopName,TX) {PopName+"."+TN,indControl}..Width += TD * {PopName+"."+TN,indControl}..AnchorRateWidth / 1000 END RETURN |
| |
| |
| | | |
|
| | |
| |
| Publicado el 02,marzo 2016 - 10:46 |
Hi Guenter
Thats exactly what I am looking for. Much appreciated. Mark |
| |
| |
| | | |
|
| | |
| |
| Publicado el 02,marzo 2016 - 11:55 |
If you use the AAF feature to export the table content to excel be carefull with the column order.
check the ConfigureAAF function in the help. |
| |
| |
| | | |
|
| | | | |
| | |
|