Get/remember user column reordering?

Questions and answers for designing and implementing forms in Servoy

Get/remember user column reordering?

Postby djlapin » Tue Mar 05, 2013 11:06 pm

Is it possible in tableview, with web client, to remember and restore the column drags that the user has made, between sessions?

Thanks,
Don
djlapin
 
Posts: 309
Joined: Fri Feb 18, 2011 9:36 am
Location: San Francisco, CA

Re: Get/remember user column reordering?

Postby mboegem » Wed Mar 06, 2013 3:10 am

Hi Don,

It should be possible to request the 'x' value of an element.
This means you have to name every element you put on a tableview.
Then sort the x values and you have the column order.

So far I only used this in smart-client, but I assume this should work in the same way for web-client.
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1752
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Get/remember user column reordering?

Postby djlapin » Wed Mar 06, 2013 9:57 am

Hi Marc,

Do you mean I can store an array of "x" values in a field for the user's preference table, and then restore it when the (structure/static) form is displayed...this will change the column order?

Thank you,
Don
djlapin
 
Posts: 309
Joined: Fri Feb 18, 2011 9:36 am
Location: San Francisco, CA

Re: Get/remember user column reordering?

Postby mboegem » Wed Mar 06, 2013 10:33 am

Yes that should be possible.
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1752
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Get/remember user column reordering?

Postby djlapin » Thu Mar 07, 2013 12:10 am

Hi Marc,

I tried but did not meet with success. I used this to collect the original column order:

Code: Select all
if(firstShow) {
     // obtaining default column order
   for (i = 0; i < elements.allnames.length; i++) { 
      elemName = elements.allnames[i]
      aStudentColNameDflt.push(elemName);
      aStudentColXDflt.push(elements[elemName].getLocationX());
   }   
}


I then dragged columns around, and clicked on a column header (as a quick test button) to see if I could restore the original order:

Code: Select all
//restoring column order --
for (i = 0; i < aStudentColNameDflt.length; i++) {
     y = elements[aStudentColNameDflt[i]].getLocationY();
     elements[aStudentColNameDflt[i]].setLocation(aStudentColXDflt[i],y);
}
application.updateUI();


When I trace, I can see that the original "x" values and column names are there. However, the setLocation doesn't appear to be restoring the original column order.

Is this how you would approach it? (I'm using 6.0 point 8.)

Thank you,
Don
djlapin
 
Posts: 309
Joined: Fri Feb 18, 2011 9:36 am
Location: San Francisco, CA

Re: Get/remember user column reordering?

Postby mboegem » Thu Mar 07, 2013 10:29 am

Hi Don,

currently working in 6.1.2, but this approach is working for me.
I don't think there should be any difference between 6.0.8 and 6.1.2

The only thing might be your y position.
Basically the actual value doesn't matter and you could all elements at the same y (as long as the y value is within your body part)
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1752
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam


Return to Forms

Who is online

Users browsing this forum: Google [Bot] and 9 guests

cron