Page 1 of 1

DV, Order of groups?

Posted: 2020-11-17 08:48
by onoehring
Hi Jan,

I created some groups, but they show up in a different order than I defined them. Is that normal? If yes, what is the order? Can I set the order myself?

Code: Select all

var dv = AppGiniHelper.DV;
dv.addGroup("grp_SettingsAttachments", "Anhänge", [...]);
dv.addGroup("grp_SettingsLocation", "Platzdefinition", [...]);
dv.addGroup("grp_SettingsJobliste", "Job-Liste", [...]);
dv.addGroup("grp_SettingsRest", "Diverses", [...]);
Looks like this:
grouporder.png
grouporder.png (2.25 KiB) Viewed 5575 times
Yes, I cleared the browser cache and reloaded the page (tried multiple times).

Olaf

Re: DV, Order of groups?

Posted: 2020-11-17 09:03
by jsetzer
Hi Olaf,

that looks strange. I am going to have a look at this issue.

I don't think this will have a different effect, but anyway, can you please try the same using chaining technique like this:

Code: Select all

var dv = AppGiniHelper.DV
  .addGroup("grp_SettingsAttachments", "Anhänge", [...])
  .addGroup("grp_SettingsLocation", "Platzdefinition", [...])
  .addGroup("grp_SettingsJobliste", "Job-Liste", [...])
  .addGroup("grp_SettingsRest", "Diverses", [...])
  ;
Sorry for inconvenience!

Re: DV, Order of groups?

Posted: 2020-11-17 09:09
by onoehring
Hi Jan,

no change with your suggestion.
I removed all ; in the end, expect the very latest which I placed on the new line as well. Also removed the dv. before all addGroup's.
OLaf

Re: DV, Order of groups?

Posted: 2020-11-17 09:16
by jsetzer
Hi Olaf,

good news is:
I can reproduce this behaviour.

bad news is:
I can reproduce this behaviour

chrome_0sIAqpK2Qj.png
chrome_0sIAqpK2Qj.png (7.4 KiB) Viewed 5566 times

Gonna do some research today and hopefully find a workaround for now and a bugfix for next version.

Stay tuned!

Re: DV, Order of groups?

Posted: 2020-11-17 09:26
by onoehring
Hi Jan,

great, that it's a reproducible behaviour. Take your time. And thank you already.
Olaf

Re: DV, Order of groups?

Posted: 2020-11-17 09:43
by jsetzer
It seems to be related to read only fields:
As soon as I put a readonly field into a group, that group will be placed top. So I will have to do some research on this and see if something has changed with form-control-static recently.

Re: DV, Order of groups?

Posted: 2020-11-17 10:26
by jsetzer
Workaround for now

Move the groups using jQuery:

Code: Select all

$j("#grp_4").insertAfter("#grp_3");

Re: DV, Order of groups?

Posted: 2020-11-17 10:30
by onoehring
Hi Jan,
thank you. For me it's on a settings page only at this time, so I will wait for the next version - where I am sure you will have it fixed.
Olaf

Re: DV, Order of groups?

Posted: 2020-11-17 10:46
by onoehring
Hi Jan,

just dropped to my mind: In my case I do NOT have a read only value in the groups. I will drop you a screenshot in PM.

Olaf

Re: DV, Order of groups?

Posted: 2020-11-17 11:10
by jsetzer
You are right, @Olaf, and my first guess was wrong: It has nothing to do with form-control-static, it seems.

Digging deeper, I remember the panels will be sorted in order of the fields. The position of the first field of a group decides about the placement of the panel.


Solution

You can change the order of the panels by changing the order of the fields in your model (in AppGini itself).


Workaround

For a more flexible positioning you can move panels to every other place using jQuery:

Code: Select all

$j("#grp_4").insertAfter("#grp_3");

Future release

I consider modifing the group placement algorithm to better reflect the sorting-order according to serial order of .addGroup()-commands in the javascript code. For backward-compatibility reasons this sorting behaviour should become configurable.