Creating a Table View Page

Configure native KAS tables with full arrays, stable row keys and supported field options.

A native Table View renders rows from an existing authorized query. Register the page with V, adding R for search, N for pagination or L for live inputs as required.

Arrays are the newer full, extensible configuration and are preferred for new definitions. Strings remain compatible legacy shorthand/quick syntax. Option keys are specific to each native field type.

Page configuration

The following table and column names are placeholders for an existing application schema. Select its real stable row key, one field for each header, and preserve %%WHERE%% for native predicates.

$dbtable = 'EXISTING_TABLE';
$idfield = 'ROW_ID';
$td_titles = ['NAME', 'ENABLED'];
$td_fields = [
    ['type' => 'text', 'col' => 'NAME', 'options' => []],
    ['type' => 'status', 'col' => 'ENABLED', 'options' => []]
];
$query = 'SELECT ROW_ID, NAME, ENABLED FROM EXISTING_TABLE %%WHERE%% ORDER BY NAME, ROW_ID';
include('core/table_view.php');

A derived boolean must supply 0 or 1. Use the native check/X indicator for read-only state, rather than an editable switch. Keep authorization and validation in the owning page/save operation.

Full-array select with nonempty options

$td_fields = [];
array_push($td_fields, [
    'type' => 'live',
    'inputType' => 'select',
    'col' => 'STATUS',
    'options' => [
        ['name' => 'Draft', 'value' => 'draft'],
        ['name' => 'Ready', 'value' => 'ready']
    ],
    'showAllTxt' => 'Select a status'
]);

On an authorized VL Table View, select the actual row key and STATUS in the owning query. Each name is the displayed label and value is the stored value. The current value is preselected. If none matches, an empty selected choice is inserted; showAllTxt defaults to Select an option. This example creates no database columns and grants no write permission. Validate allowed values in the owning save handler.

Test the final query with native search, counting, sorting and pagination. A visible row index is not a database identifier. See the separate field, filter and export guides for their supported options.

Related native actions

Section-level $actionButton, per-row $rowActions and selected-row bulk controls have different configuration and scope. Use Native Table View custom row actions for the complete manual-action array, placeholders, icons, tooltips, conditions, disabled states, confirmation, keyboard access and its relationship to Edit, Delete and Clone. Full arrays are the modern extensible format; strings remain compatible legacy shorthand. Each destination must authorize its request independently.