AnsweredAssumed Answered

Select/deselect rows in a portal

Question asked by Stu412 on Jul 8, 2016
Latest reply on Jul 15, 2016 by Stu412

Hi there


Looking for some technique advice here really.  I have a portal in which there is a list of records representing a contents/index page.  I wish to allow the user to re-order these using up and down arrows.  The use case would be two stage:


Stage One


  • Click on content row in the portal
  • It becomes highlighted


Stage Two


  • Click either up or down arrow to move it up or down the portal


Stage One (Repeated if necessary)


  • Click another content row
  • Previous highlighted row turns off
  • New row is highlighted


Stage Two (Repeated if necessary)


  • Click either up or down arrow to move second selected row up or down in the portal
  • Repeat as necessary


This can be done by scripts but I feel they're getting very slow and this is where I need some help just in case I've missed something or there is a better way to do this.


I have two fields on the child (portal) table, one called SORT and one called SELECTED.  The SORT field is a number which determines where in the portal set the record sits.  The SELECTED field is either Y or N and determines which row you are moving up and down the portal.


I have an OnEnter script which fires when the user clicks any field on the portal row.


As I see it, this script needs to:


  • Set Field [SELECTED] of the current record to Y
  • Set all other [SELECTED] records to N


A second script then organises the SORT field via a button setup defined against Up and Down arrow images.


As I see it, this script needs to:


  • Set Variable of the SORT value of the current record
  • Increase or decrease by one to change its position in the sort order
  • Renumber the remaining records correctly to maintain order (prevent something like 1,2,5,7, instead give us 1,2,3,4)
  • Check the new SORT value is not <0


As I say, I may well be over complicating this, but it needs to be a slick routine so that people can and will use it.


Thanks in advance