A native KAS Table View live select saves the selected value when the selection changes. Enable the V and L option types for the page. Set $dbtable and $idfield, and select both the primary key and the edited column in the row query.
Add the header and live field
Use one header per field, at the same position in the two arrays. This example uses the existing KAS Core client-category relationship: CLIENTS.CCID references CLIENT_CATEGORIES.CCID. Display TYPE and save the category ID.
$dbtable = 'CLIENTS';
$idfield = 'CLID';
$td_titles = [['name' => 'CATEGORY', 'width' => '180']];
$td_fields = [[
'type' => 'live',
'inputType' => 'select',
'col' => 'CCID',
'optionsdb' => [
'table' => 'CLIENT_CATEGORIES',
'op_name' => 'TYPE',
'op_val' => 'CCID',
'order' => 'pos, CCID'
]
]];
$query = "SELECT CLID, CCID FROM $dbtable %%WHERE%% ORDER BY CLID";
include('core/table_view.php');
This is a minimal Core example. Add its header, field and selected column to your page's existing configuration; preserve its routing, privileges, search, filters and pagination. No custom AJAX endpoint is required.
Database-driven options
optionsdb calls the native genSelectOptions() function. table identifies the lookup table, op_name supplies the labels and op_val supplies the saved values. Optional where and order properties are SQL fragments controlled by the page. Do not interpolate untrusted request values into them. Newly created or renamed options are reflected when the table reloads.
Static options for other fields
When choices are fixed, use options instead of optionsdb:
'options' => [
['name' => 'First choice', 'value' => 1],
['name' => 'Second choice', 'value' => 2]
]
Place this property inside the live-select field definition. Use the actual column and schema values for your field; these static names and numbers are placeholders. For client categories, use the database-driven configuration above.
Optional field properties include privilege, class and attributes. privilege controls the native field display threshold; for example, 4 limits display to accounts at that level or higher. class adds CSS classes, and attributes adds intentional HTML attributes. These UI settings do not replace server authorization or database constraints.
Selection, persistence and sorting
The stored column value selects its matching option. If no option matches, including an unassigned nullable field, the renderer adds an empty selected placeholder. showAllTxt customizes its text, which defaults to "Select an option". A matching value does not automatically retain a separate clear-assignment choice. The native LIVE handler writes SQL NULL for an empty submitted value and the chosen ID for a non-empty value.
Option ordering and table-row sorting are separate. A live select does not automatically make its header sortable. Configure row sorting deliberately and use identifiers or expressions supported by both row and count queries. Verify changes persist after reloading, and retain the page's existing privilege and schema checks.
Current KAS-Core source is authoritative: the select renderer is in kas/core/table_view.php, option generation is in kas/core/functions.php, change handling is in kas/js/live_edit.js, and saving uses kas/core/db_actions/query_builder.php.
Client category choices now use native position order pos, CCID; category management, the Category filter and live selects share this order. The position column and ordering support are prepared in unpublished update 158: install that Core/database update before using this revised example. Newly added categories use the native add-last convention. This does not change category-label sorting of the client rows.