Text Field binded to table.props.data Next and Back buttons

Hi!

In ignition perspective I have a text field binded to a data from a table

.../TablaInventario.props.data[0]['Clase equipo']

so it shows the data from column "Clase equipo" in row 0

I want to add a "next" button so this text field change to next row and show its data
image

.../TablaInventario.props.data[1]['Clase equipo']

also a back button
<

For now I added expression to the text filed:

try({../TablaInventario.props.data}[{../custom.currentIndex}]['Clase equipo'], "")

And this to the next button:

def runAction(self, event):

    totalRows = len(self.getSibling("TablaInventario").props.data)

    if self.view.custom.currentIndex < totalRows - 1:
        self.view.custom.currentIndex += 1

and back button:

   if self.view.custom.currentIndex > 0:
        self.view.custom.currentIndex -= 1
  1. Don't offer controls options that don't work. That means disable the < if you are at the first row and disable the > if you are at the last.

  2. On the Text Field component create custom.selectedRow. Set it to 0.

  3. On < add an expression binding to enabled.
    {../TextField.custom.selectedRow} > 0

  4. On > add an expression binding to enabled.
    {../TextField.custom.selectedRow} < len({..../TablaInventario.props.data}) - 1

  5. On < add an onActionPerformed script:
    self.getSibling("TextField").custom.selectedRow -= 1

  6. On > add an onActionPerformed script:
    self.getSibling("TextField").custom.selectedRow += 1

  7. On the Text Field component props.text add an expression binding:
    {..../TablaInventario.props.data}[{this.custom.selectedRow}]['Clase equipo']

Table row to text field

2 Likes

Was this value changing? It would need to be bound to the table's selected row.

Expressions are better than scripts.
Your solution doesn't seem to disable the buttons. Again, " Don't offer controls options that don't work.".

1 Like

Yes I changed that expression {../TextField.custom.selectedRow} to {parent.custom.selectedRow}

I’m making it common across all the text fields I’m using.

my solution doesn´t disable the buttons.

right, I just deleted the post, thanks.