I’m using jstable.getColumnNames to load a list of given table’s column names. It seems that the columns are returned in no particular order, actually they are all mixed up. It would be convenient for me to have the fields in the same order as they are featured in the database, as well as in the Servoy Dataproviders dialog. I haven’t found any way of achieving this.
Can somebody at Servoy confirm?..
This probably could be changed in the next release, as nobody should be depending on the order now - the columns appear really at very random order?
automazione:
I think you can try with array .sort() function.. it should work:
var mycolumns = databaseManager.getTable(controller.getServerName(), "mytable").getColumnNames().sort()
Thanks, I already figured out that I can sort the list alphabetically. But it would be nice to have the list in the same order that the columns are listed in Servoy Dataproviders dialog - the same that you get when using “describe table” or “show create table” in MySQL. We have tables with more than 40 columns and the “most important” ones are listed first - this would be convenient for the user to find the most likely columns among the first.
(I’m creating a reporting interface, that’s the use for getColumnNames…)