Kitto.Web.Handler.View
Attribute-based handler for the "view core" data endpoints (Sprint E.2 of the routing refactor). Migrated incrementally, one endpoint per commit, from TKWebApplication.DoHandleRequest. Endpoints not yet migrated still fall through to the legacy dispatch (the attribute router runs first).
TKXViewHandlerBase is virtual so an application can subclass it and override an endpoint (or, once introduced, a hook) without forking the framework. Shared logic lives in TKWebApplication as public helpers (FindViewOrSetNotFound, PopulateRecordFromPost, …), reached via TKWebApplication.Current.
Migrated (E.2): view (bare), data, form, save, save-cache, delete, enter-edit, form-close. Migrated (E.3): lookup, wizard-finish, detail data/save/delete, tool, temp-upload, notify-change, blob. All view-domain endpoints now live here.
TKXViewHandlerBase class
procedure HandleEnterEdit([TKXPathParam('ViewName')] const AViewName: string);Apply EditRecordRules on the session record (ViewMode -> EditMode).
procedure HandleFormClose([TKXPathParam('ViewName')] const AViewName: string);Release the session store when a form is cancelled/closed without saving.
procedure HandleView([TKXPathParam('ViewName')] const AViewName: string);Render a view as an HTML fragment (bare /kx/view/{ViewName}). Falls back to treating {ViewName} as a controller class id (inline views), else 404.
procedure HandleData([TKXPathParam('ViewName')] const AViewName: string);List/grid data: rows + OOB pager/state. Handles GroupingList, TemplateDataPanel, selectable cards and the standard paged grid. TKXANY: the grid uses hx-get for filter/sort/pager and POST for the toolbar Refresh (kxGrid.refreshData), so /data must accept both methods.
procedure HandleDelete([TKXPathParam('ViewName')] const AViewName: string);Delete a record (by key), then return refreshed rows (+ OOB pager/state).
procedure HandleForm([TKXPathParam('ViewName')] const AViewName: string);Open the form dialog (op=new/add/edit/view/dup); registers the session store.
procedure HandleSave([TKXPathParam('ViewName')] const AViewName: string);Persist the record to the DB (with cascading detail stores).
procedure HandleSaveCache([TKXPathParam('ViewName')] const AViewName: string);Write posted values back to the session store only (no DB persist).
procedure HandleLookup([TKXPathParam('ViewName')] const AViewName: string);Render a view as a modal lookup dialog (aliased id + kxForm.closeLookup).
procedure HandleWizardFinish([TKXPathParam('ViewName')] const AViewName: string);Commit a brand-new record built by a wizard, running Controller/Rules before/after the save; returns a script closing the wizard on success.
procedure HandleDetailData([TKXPathParam('ViewName')] const AViewName: string;Render a detail grid (toolbar + headers + rows). GET for the initial loadDetailTab fetch, POST for HX column-sort/pager refreshes — hence ANY.
procedure HandleDetailSave([TKXPathParam('ViewName')] const AViewName: string;Add/edit a detail record in the master's in-memory detail store (no DB persist until the master is saved). Returns a script reloading the tab.
procedure HandleDetailDelete([TKXPathParam('ViewName')] const AViewName: string;Delete a detail record from the master's in-memory store: a record that was already persisted is marked rsDeleted, one that was never saved is removed outright.
procedure HandleTool([TKXPathParam('ViewName')] const AViewName: string;Execute a tool view (Controller/ToolViews or EditController/ToolViews). The tool controller writes its own response (download stream or HTML).
procedure HandleTempUpload([TKXPathParam('ViewName')] const AViewName: string;Store an uploaded file in a per-session temp dir before the form is saved; returns JSON {"ok":true,"temp":"<name>"}.
procedure HandleNotifyChange([TKXPathParam('ViewName')] const AViewName: string;Apply a single changed field to the session record (no save), letting AfterFieldChange rules fire, then return JSON of the fields that changed as a side effect.
procedure HandleBlob([TKXPathParam('ViewName')] const AViewName: string;Serve a BLOB/image or FileReference field as binary (inline or download). [TKXNavigable]: reachable by a top-level navigation — the client opens downloads via window.open and renders previews via <img>/<iframe> src, neither of which can send the X-KittoX header.
