Skip to content

onItemClick handler receives more metadata#34

Merged
jschuler merged 5 commits into
RedHat-UX:mainfrom
jschuler:field-id
Feb 16, 2026
Merged

onItemClick handler receives more metadata#34
jschuler merged 5 commits into
RedHat-UX:mainfrom
jschuler:field-id

Conversation

@jschuler

@jschuler jschuler commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

The handler receives (event, payload) where payload is an ItemClickPayload:

  • componentId — the component id
  • inputDataType — the component’s inputDataType
  • index — 0-based row index (data-view) or card index (set-of-cards, when supported)
  • fieldsRecord<string, ItemDataFieldValue> keyed by field id; each value has id, name, data_path?, and value (the cell value). Use payload.fields["field-id"]?.value to read a column.
interface ItemDataFieldValue {
  id: string;
  name: string;
  data_path?: string;
  value: string | number | boolean | null;
}

interface ItemClickPayload {
  componentId?: string;   // component id
  inputDataType?: string; // component inputDataType
  index?: number;         // 0-based index
  fields: Record<string, ItemDataFieldValue>;
}

example:

Screenshot 2026-02-16 at 10 42 55 AM

@netlify

netlify Bot commented Feb 11, 2026

Copy link
Copy Markdown

Deploy Preview for patternfly-react-renderer ready!

Name Link
🔨 Latest commit 76f7cd2
🔍 Latest deploy log https://app.netlify.com/projects/patternfly-react-renderer/deploys/69933b4a2d41f40008c4e600
😎 Deploy Preview https://deploy-preview-34--patternfly-react-renderer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread src/components/DataViewWrapper.tsx Outdated
onItemClick?: (
event: React.MouseEvent | React.KeyboardEvent,
itemData: Record<string, string | number>
itemData: Record<string, ItemDataFieldValue>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea with ItemDataFieldValue . Id like to see other input arguments here as we discussed:

  • component_id - id field from the component JSON
  • component_input_data_type - input_data_type from the component JSON
  • item_index - index of the clicked item in the array data (table row index, ideally 0 based)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, new version looks good

@jschuler jschuler changed the title onItemClick handler now has the field.id as key and item object conta… onItemClick handler receives more metadata Feb 16, 2026
@jschuler jschuler merged commit 455f9f0 into RedHat-UX:main Feb 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants