Datatable column order

Use this Forum to post your “How to …” questions about your use of aXes. This is not a technical support forum. Both the aXes Support Team at LANSA and other aXes customers may answer your questions. LANSA cannot guarantee the accuracy of any information posted by customers.

Moderator: jeanmichel

Post Reply
User avatar
Dino
Posts: 88
Joined: 19 May 2017, 08:29

Datatable column order

Post by Dino » 19 Jul 2023, 04:08

Hi guys,

If I create a dynamic table like this one:

Code: Select all

DefineObjectInstance { 

      className          = "DynamicTable", 
      name               = "Empleados",   
      source             = "sql", 
      selectSQLcommand   = "EMPNO,SURNAME,GIVENAME,SALARY from G14RHOLIB.PSLMST", 
      resultColumnNames  = { "ID", "Apellido", "Nombre", "Salario" }, 

    }; 
then add the datatable in a panel, the columns are in a different order.

I notice that if use numbers in the order property it changes the order of the columns, but still
seems random....

Code: Select all

ENV.returnValue = [1,2,3,4];
any idea how to select the order of the columns for a datatable?
I am chasing the right order alternating numbers, but not getting there... a refresh and the order
is gone...
datatableorder.jpg
datatableorder.jpg (338.68 KiB) Viewed 15071 times
datatableorder2.jpg
datatableorder2.jpg (225.62 KiB) Viewed 15070 times

User avatar
jeanmichel
Posts: 109
Joined: 23 May 2014, 11:37
Location: Sydney

Re: Datatable column order

Post by jeanmichel » 02 Aug 2023, 11:29

Hi Raul,

I have been looking into this issue for you.

The purpose of the "order" property is not to define in which order to show the columns. It is used to define the sort of the data inside the column, as per the datatables documentation.

In order to arrange the columns you would need to set the property columnNames as below.
ENV.returnValue = [{title: 'ID'},
{title: 'Apellido'},
{title: 'Nombre'},
{title: 'Salario'}];
By changing the order above you can arrange the columns of the datatable.
Regards,

Jean-Michel Rapin

LANSA Pty Ltd
email: JeanMichel.Rapin@lansa.com.au
Address: 122 Arthur Street, North Sydney, NSW 2060, Australia
Tel: +61 289 070 262 http://www.lansa.com | http://blog.lansa.com |

User avatar
Dino
Posts: 88
Joined: 19 May 2017, 08:29

Re: Datatable column order

Post by Dino » 02 Aug 2023, 22:53

Thank you Jeanmichel! that solves it.

Post Reply