This is a simple little script for form views that replaces the functionality of the up and down scroll buttons. It changes the single-line selection of a set to the next row, so the form will display the information for that single row.
This is the script for the next button
/** Back/Next Buttons * * @author Tim Dudgeon ([email protected]) */ import com.im.df.api.dml.* import com.im.df.api.support.SelectionDescription import com.im.ijc.core.api.util.IJCCoreUtils // On click do evaluation: evaluate = { widget -> def rs = widget.form.resultSet def rootVS = rs.rootVertexState def dataTree = rs.dataTree def rootEntity = dataTree.rootVertex.entity // Change the selection to the next row: SelectionDescription sel = rootVS.getSelection() if (sel.isSingleRow()) { SelectionDescription nextRowSel = SelectionDescription.move(sel, 1, rootVS.size) IJCCoreUtils.setNewSelection(rootVS, nextRowSel) } } // If the selection changed: on_change = { widget, button -> def rs = widget.form.resultSet def rootVS = rs.rootVertexState def dataTree = rs.dataTree def rootEntity = dataTree.rootVertex.entity // Disable button functionality if current selection points to the last row: SelectionDescription sel = rootVS.getSelection() button.setEnabled(sel.isSingleRow() && (sel.maxSelectionIndex + 1 < rootVS.size)) }
To alter this script to be the 'back' version, simply change the line 19 to:
SelectionDescription nextRowSel = SelectionDescription.move(sel, -1, rootVS.size)
Update disabling functionality in the way that it's not disabled at the last row but at the first:
button.setEnabled(sel.isSingleRow() && (sel.maxSelectionIndex != 0))
Versions: This script has been tested on IJC versions 6.0