Skip to content

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

pascal
procedure HandleEnterEdit([TKXPathParam('ViewName')] const AViewName: string);

Apply EditRecordRules on the session record (ViewMode -> EditMode).

pascal
procedure HandleFormClose([TKXPathParam('ViewName')] const AViewName: string);

Release the session store when a form is cancelled/closed without saving.

pascal
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.

pascal
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.

pascal
procedure HandleDelete([TKXPathParam('ViewName')] const AViewName: string);

Delete a record (by key), then return refreshed rows (+ OOB pager/state).

pascal
procedure HandleForm([TKXPathParam('ViewName')] const AViewName: string);

Open the form dialog (op=new/add/edit/view/dup); registers the session store.

pascal
procedure HandleSave([TKXPathParam('ViewName')] const AViewName: string);

Persist the record to the DB (with cascading detail stores).

pascal
procedure HandleSaveCache([TKXPathParam('ViewName')] const AViewName: string);

Write posted values back to the session store only (no DB persist).

pascal
procedure HandleLookup([TKXPathParam('ViewName')] const AViewName: string);

Render a view as a modal lookup dialog (aliased id + kxForm.closeLookup).

pascal
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.

pascal
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.

pascal
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.

pascal
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.

pascal
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).

pascal
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>"}.

pascal
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.

pascal
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.

Released under Apache License, Version 2.0.