Hello,
I would like to have a function, sliding records in a list by an “up” and “down” button.
Do anybody have a solution?
Thomas
Hello,
I would like to have a function, sliding records in a list by an “up” and “down” button.
Do anybody have a solution?
Thomas
I think that your sliding could be managed by sorting your records,
one solution could be:
Add an number field to sort your record on each record you add as the value of the last record +1000
Rec A : 1000
Rec B : 2000
Rec C : 3000
Slide up C => update your sorting field in record c
rec.sortingfield value = sum (the two previous record value )/2
tu you’ll have
Rec A : 1000
Rec C : 1500
Rec B : 2000
Slide up C (A is the first record so c = first record value /2
Rec C : 500
Rec A : 1000
Rec B : 2000
Then slide Up B
Rec C : 500
Rec B : 750
Rec A : 1000
etc …
Insert Record between C and B
Rec C : 500
Rec D : 625
Rec B : 750
Rec A : 1000
This kind of solution permit you edit only one record each time, and permit easy record insert
I use the same technique - works great. Use a numeric data type (I call my field “seq” - short for “sequence”) and you can use numbers like this:
Record: Seq Value:
A 1.0
B 2.0
C 3.0
Then to “move” C to B position - set the seq to 1.5, sort the list, and then use the databaseManager.foundsetUpdater to re-number the rows.
It’s very fast - and works well.
Thank you very much Fabrice and Bob for your answer!
Your examples are looking logic and easy. I will try and reply how it works for me.
Thomas
I made it for a list in a tabpanel! It works excellent and really fast. Thank you once more guys.
Thomas