Updated DataTable Actions Behavior Test

✅ New Action Behavior Summary

Action Type Changes:

Updated Action Types Matrix:

Action Type Property Location Enabled When Data Received
Global None (default) Above table Always None
Single Selection requiresSelection: true Above table Exactly 1 row selected Selected row object
Row Action rowAction: true Actions column Always (per row) Individual row object
Bulk requiresMultipleSelection: true Above table (when selected) 1+ rows selected Array of selected rows

Implementation Changes Made:

  1. Computed Properties Updated:
    • globalActions: Actions with no special properties
    • singleSelectionActions: Actions with requiresSelection: true
    • rowActions: Actions with rowAction: true
    • bulkActions: Actions with requiresMultipleSelection: true
  2. Template Updates:
    • Global Actions section now includes single selection actions
    • Single selection actions are disabled unless exactly one row is selected
    • Visual feedback shows selection state
    • Actions column only shows rowAction: true actions
  3. New Handler Added:
    • handleSingleSelectionAction: Passes selected row data to action

Example Configuration (Clients.vue):

const tableActions = [
  // Global action - always available
  {
    label: "Add Client",
    action: () => modalStore.openModal("createClient"),
    icon: "pi pi-plus",
    style: "primary"
  },
  // Single selection action - enabled when exactly one row selected
  {
    label: "View Details", 
    action: (rowData) => router.push(`/clients/${rowData.id}`),
    icon: "pi pi-eye",
    style: "info",
    requiresSelection: true
  },
  // Bulk action - enabled when rows selected
  {
    label: "Export Selected",
    action: (selectedRows) => exportData(selectedRows),
    icon: "pi pi-download", 
    style: "success",
    requiresMultipleSelection: true
  },
  // Row actions - appear in each row
  {
    label: "Edit",
    action: (rowData) => editClient(rowData),
    icon: "pi pi-pencil",
    style: "secondary",
    rowAction: true
  },
  {
    label: "Quick View",
    action: (rowData) => showPreview(rowData),
    icon: "pi pi-search",
    style: "info", 
    rowAction: true
  }
];

User Experience Improvements:

Action Flow Examples:

✅ Testing Checklist