Skip to content

Tabular Entry

Tabular Entry Screenshot

Tabular entry displays a table where some columns are editable input fields. Use it for multi-row data entry scenarios like bulk updates.

Basic Usage

from ux3270.dialog import TabularEntry
from ux3270.panel import FieldType

te = TabularEntry("PORTFOLIO UPDATE", panel_id="PORT01")

# Static columns (display only)
te.add_column("Ticker", width=8)
te.add_column("Name", width=20)
te.add_column("Current", width=12)

# Editable column
te.add_column("New Amount", width=12, editable=True, required=True,
              field_type=FieldType.NUMERIC)

# Add rows
te.add_row(Ticker="AAPL", Name="Apple Inc", Current="1,234.56")
te.add_row(Ticker="GOOGL", Name="Alphabet", Current="5,678.90")

result = te.show()
if result:
    for row in result:
        print(f"{row['Ticker']}: {row['New Amount']}")

Column Types

# Static column (display only)
te.add_column("ID", width=10)

# Editable column
te.add_column("Quantity", width=8, editable=True)

# Required editable column (marked with *)
te.add_column("Amount", width=10, editable=True, required=True)

# Numeric input
te.add_column("Price", width=10, editable=True,
              field_type=FieldType.NUMERIC)
  • Tab - Move to next editable cell
  • Shift+Tab - Move to previous editable cell
  • F7/F8 - Page up/down for large datasets
  • Enter - Submit all values

Validation

Validation runs on Enter:

def validate_quantity(value):
    return int(value) > 0

te.add_column("Qty", width=8, editable=True,
              validator=validate_quantity)

Error messages appear on the error line when validation fails.

Return Value

Returns a list of dicts combining original data with edited values:

result = te.show()
# result = [
#     {"Ticker": "AAPL", "Name": "Apple Inc", "Current": "1,234.56", "New Amount": "2000"},
#     {"Ticker": "GOOGL", "Name": "Alphabet", "Current": "5,678.90", "New Amount": "3000"},
# ]

Returns None if cancelled (F3).

API Reference

ux3270.dialog.TabularEntry

IBM 3270-style tabular entry with mixed static and input columns.

Displays a table where some columns are editable input fields and others are static display text. Supports multi-row data entry.

Follows CUA conventions: - Panel ID at top-left, title centered - Column headers in intensified text - Static columns in turquoise (protected) - Input columns in green with underscore placeholders - Tab navigates between editable cells - F7/F8 for pagination - Enter submits, F3 cancels

The dialog builds a Screen definition and hands control to Screen for all rendering and input handling.

__init__(title='', panel_id='', instruction='Enter values and press Enter to submit')

Initialize a tabular entry.

Parameters:

Name Type Description Default
title str

Table title (displayed in uppercase per CUA)

''
panel_id str

Optional panel identifier

''
instruction str

Instruction text

'Enter values and press Enter to submit'

add_column(name, width=10, editable=False, field_type=FieldType.TEXT, required=False, validator=None)

Add a column definition.

Parameters:

Name Type Description Default
name str

Column name

required
width int

Display width

10
editable bool

Whether this column is an input field

False
field_type FieldType

Field type (TEXT, NUMERIC, etc.)

TEXT
required bool

Whether field is required (editable columns only)

False
validator Optional[Callable[[str], bool]]

Optional validation function

None

Returns:

Type Description
TabularEntry

Self for method chaining

add_row(**values)

Add a data row.

Parameters:

Name Type Description Default
**values

Column name to value mapping

{}

Returns:

Type Description
TabularEntry

Self for method chaining

show()

Display the tabular entry and process user input.

Returns:

Type Description
Optional[List[Dict[str, Any]]]

List of dicts with row data (original + edited values),

Optional[List[Dict[str, Any]]]

or None if cancelled.