Acknowledging before commit
A request being sent is not success. Wait for the database transaction.
Make drafts visible, save changes together, and preserve work after a failure.
Let a team edit and reorder board cards, review the pending changes, and save once. A rejected save keeps the draft. An accepted response becomes the new baseline.
Use this when several related edits should commit together. For an immediate-save workflow, expose that behavior explicitly instead of keeping an unrelated Save button.
RequestId + Cards + ChangesReal BluKavantUI components, with a small application controller. Data and save responses are simulated in this page; reload resets the example.
Loading the interactive recipe…
Owns editing, reordering, the dirty count and the Save/Discard lifecycle.
AllowEditing and EnableBulkSave expose the built-in editor and toolbar. Do not add a competing Save button or persist every CardsChanged event.
SaveRequested provides RequestId, the complete Cards list and Changes. Save the submitted snapshot, including cards hidden by search.
Your service rechecks permissions, allowed moves and record versions. Either commit the whole batch or reject it; a success acknowledgement must describe what actually committed.
Return the same request ID with success or failure. On success, return the full canonical list, including real IDs for newly created cards. On failure, leave the draft available.
| State / contract | Implementation |
|---|---|
| Draft notification | CardsChanged updates screen state. DirtyChanged can drive a navigation guard. Neither is a persistence acknowledgement. |
| SaveRequested | requestId: string; cards: KanbanCard[]; changes: KanbanChange[]. Changes include Before, After and positions. |
| Success | update({SaveResultRequestId, SaveResultSuccess:true, SaveResultCards: fullCanonicalCards}). |
| Failure / conflict | update({SaveResultRequestId, SaveResultSuccess:false, SaveResultMessage}). Explain conflicts without overwriting the local draft. |
Call mount(host, columns, cards, saveBoard). Implement saveBoard as one authorized, version-checked transaction returning the complete canonical card list. The example adapter waits briefly and can reject one attempt; it never calls a real persistence endpoint.
Install Community and the required Pro add-on for Grid or Kanban recipes, import @blukavantui/community/styles.css and @blukavantui/pro/kanban.css, and use a connected host element. The companion CSS styles the surrounding fields, navigation and status messages.
Keep the recipe and shared.ts together; TypeScript resolves the recipe’s ./shared.js import. Add class="recipe-demo" to your host. Supply your records and backend callback as the mount arguments. The downloads use Community 1.0.0 and Pro 1.0.0 imports; the live demo retains its previously verified SDK 0.9.0 runtime.
import { createKanban } from '@blukavantui/pro/kanban';
import type {KanbanCard, KanbanColumn, KanbanChange} from '@blukavantui/pro';
import { node, status } from './shared.js';
export type SaveBoard = (requestId: string, cards: KanbanCard[], changes: KanbanChange[]) => Promise<KanbanCard[]>;
export function mount(host: HTMLElement, columns: KanbanColumn[], cards: KanbanCard[], save: SaveBoard) {
const target = node('div'); host.append(target);
const message = status(host); let disposed = false;
const board = createKanban(target, {
Columns: columns, Cards: cards, AllowEditing: true, AllowReorder: true,
EnableBulkSave: true, ShowSearch: true,
}, {
DirtyChanged: count => { message.textContent = count ? `${count} cards changed. Not saved yet.` : 'No unsaved changes.'; },
SaveRequested: async (requestId, submitted, changes) => {
message.textContent = 'Saving the complete batch…';
try {
// The server validates versions, permissions and the entire transaction.
const canonical = await save(requestId, submitted, changes);
if (disposed) return;
board.update({ SaveResultRequestId: requestId, SaveResultSuccess: true,
SaveResultMessage: 'Changes saved.', SaveResultCards: canonical });
message.textContent = 'Saved. This response is now the accepted baseline.';
} catch {
if (disposed) return;
board.update({ SaveResultRequestId: requestId, SaveResultSuccess: false,
SaveResultMessage: 'Could not save. Your draft is still available; retry or discard.' });
message.textContent = 'Save rejected. The draft is still available.';
}
},
});
return { destroy() { disposed = true; board.destroy(); host.replaceChildren(); } };
}
Use BluKavantUi_Pro_Data → Kanban and its public BluKanbanColumn/BluKanbanCard structures. This recipe uses the Pro editing and bulk-save contract.
| Binding / handler | Implementation |
|---|---|
| Inputs | Bind Columns and Cards lists; set AllowEditing=True and EnableBulkSave=True. |
| OnCardsChanged | Deserialize CardsJson as BluKanbanCard List and assign it to the local list bound to Cards. Do not write to the database here. |
| OnSaveRequested | Map RequestId, CardsJson and ChangesJson to one Client Action. Call a Server Action that validates and commits the batch. |
| Success Assign | SaveResultRequestId=RequestId; SaveResultSuccess=True; SaveResultMessage="Changes saved."; SaveResultCardsJson=the complete saved list. |
| Failure Assign | SaveResultRequestId=RequestId; SaveResultSuccess=False; SaveResultMessage=a useful safe reason; SaveResultCardsJson="". Handle exceptions through this same path. |
| Intentional reload | Only after an explicit discard decision, assign new Cards and change ResetKey together. Do not use ResetKey for routine input updates. |
Add these native Blocks to your consumer Screen, bind the listed events and connect your application actions. The interactive example above runs the web implementation.
Open the full native Kanban API →A request being sent is not success. Wait for the database transaction.
SaveResultCards replaces the complete baseline. Return every card or omit it to accept exactly the submitted list.
Use request IDs or an idempotency policy on the service so a lost response does not create duplicate records.
Use the linked component accessibility notes when reviewing focus, keyboard behavior and status announcements in your implementation.