atata

Odd Table implementation - can Atata support this oddness?


I have a table thus:

<tbody>
  <tr class="bg-light">
    <th scope="col" width="300">Custom Field Name</th>
    <th scope="col">Data</th>
  </tr>

  <tr class="test-custom-field-row">
    <td>Character 1900</td>
    <td>Thing 1</td>
  </tr>

Notice the header inside the first row object. So, I can't do anything cool like:

CustomDisplayFields.Rows[x => x.Name == "Character1900"].Data.Should...

because we choke on the first row, because there are no <td> objects in it. Is there any Yevgeniy Attribute magic that tells the table definition to ignore the first row? Here's my table implementation:

    public Table<Field, _> CustomDisplayFields { get; private set; }

    public class Field : TableRow<_>
    {
        [FindByColumnIndex(0)]
        public Text<_> Name { get; private set; }

        [FindByColumnIndex(1)]
        public Text<_> Data { get; private set; }
    }

Thanks ever-so-much.


Solution

  • You can specify row control definition with XPath that skips the first row. Try to add one of the below attributes to your Field table row class.

    [ControlDefinition("tr[position() > 1]", ComponentTypeName = "row")]
    

    Or

    [ControlDefinition("tr[td]", ComponentTypeName = "row")]
    

    The first one just skips the first row. The second one selects only rows that have td as a child.