board logo
WUICTeam
  • WUICTeam
  • 100% (Exalted)
  • Newbie Topic Starter
26 days ago
Update: the declared type of rowCustomSelect now matches the real call order, ($event, rowData, dt). Fixed in WUIC Framework 1.8.0 .
The original answer below describes versions before 1.8.0.

Update (4 November 2026): the documentation has been fixed. The List Grid  and Data Repeater pages now show the signature the framework actually uses, ($event, rowData, dt), and from the next release after 1.7.31 the TypeScript declaration of the input matches it too. The answer below is still valid: runtime behaviour has not changed.

Question
I bound a handler to the rowCustomSelect input of <wuic-list-grid> to open a dialog when the user clicks a row. The handler is typed as (rowData, $event, dt), like the declaration of the input, but my guard on rowData?.id always returns early and nothing happens. No console error. What is going on?

Answer
At runtime the grid calls the callback with the arguments in a different order than the declared type: the call is rowCustomSelect($event, rowData, dt), so the event comes first and the record second. The input is declared as (rowData: any, $event: any, dt: Table) => void, and the compiler does not complain because every parameter is any. Your handler receives the DOM event in the rowData slot, rowData?.id is undefined, the guard returns, and the failure is completely silent.

The fix is to follow the real order:


// host component
onRowSelected = (_event: any, rowData: any, _dt: any): void => {
  if (!rowData?.id) return;
  this.openDetail(rowData);
};


<wuic-data-source #ds [hardcodedRoute]="'preventivi'" [autoload]="true"></wuic-data-source>
<wuic-list-grid [hardcodedDatasource]="ds" [rowCustomSelect]="onRowSelected"></wuic-list-grid>

Two more details worth knowing:

  • Define the handler as an arrow-function property, as above. The grid invokes it as a method of its internal row template, so a regular method would lose the this of your host component.
  • When rowCustomSelect is set, the grid switches the table to single selection and stores the clicked record as the current selection, so the selected row is highlighted without extra code.


If you are debugging a handler that does nothing, log arguments first: you will see the event object where you expected the record.

Documentation: List Grid