Detail row feature of ngx-datatable

I've been attempting to implement the Ngx-datatable detail row feature following the documentation, but I've had no success so far.

Here's the plunker I created: https://embed.plnkr.co/yQv0Gvy8E8k1bqRr5Pxx/, where I basically replicated the row detail demo from Swimlanes online documentation '

I am trying to utilize the rowHeight binding as outlined in the manual:

<ngx-datatable-row-detail [rowHeight]="getHeight" #myDetailRow (toggle)="onDetailToggle($event)">
  <ng-template let-row="row" ngx-datatable-row-detail-template>
    <div><strong>Address</strong></div>
    <div>{{row.address.city}}, {{row.address.state}}</div>
  </ng-template>
</ngx-datatable-row-detail>

and TS:

getHeight(row: any, index: number): number {
  return row.someHeight;
}

But, I keep encountering the issue of 'row' being undefined. What am I overlooking?

Alternatively, I also tried to access my original rows array from the getHeight function but still couldn't get the rows defined.

console.log(this.rows[index]);

Thank you!

UPDATE - FIX

The fix I implemented was simple:

getHeight(row: any): number {
  if(row) {
    return row.someHeight;
  }
}

Answer №1

When performing this action:

[rowHeight]="getHeight" 

You are essentially connecting rowHeight to the function object getHeight.

What you likely intend to do is connect it to the output of the getHeight(...) function instead:

[rowHeight]="getHeight(...)" 

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Occasionally encountering missing modules with Vscode and NestJs

This situation is really frustrating: I started a brand new NestJs project using the @nestjs/cli command. Everything was going smoothly at first. However, after adding a controller with nest generate controller mycontroller and installing types for jasmine ...

What are the steps for implementing the Ionic 2 Pulling Refresher feature in my application?

Hey everyone, I'm currently working on developing a mobile app using AngularJS 2/Ionic2. I am facing an issue with implementing a pull-to-refresh feature in my app. We followed the steps outlined in this link, and while we were able to get the page to ...

Ensure that the method is passed a negative number -1 instead of the literal number 1 from an HTML error

This is an example of my HTML code: <button (mousedown)="onMouseDown($event, -1)"></button> Here is the TypeScript code for handling the mouse down event: onMouseDown(e: MouseEvent, direction: 1|-1) { this.compute.emit(direction); ...

Triggering the detection of changes even when the value linked to remains the same

I'm facing an issue with a component that is supposed to react to changes in input controls by reformatting the input and removing certain characters. If the removed character corresponds to the previous value, the component fails to detect any change ...

Using AngularFire2 to manage your data services?

After diving into the resources provided by Angular.io and the Git Docs for AngularFire2, I decided to experiment with a more efficient approach. It seems that creating a service is recommended when working with the same data across different components in ...

Verify that the password is entered correctly in Angular2

My Angular2 form looks like this: this.registerForm = formBuilder.group({ 'name': ['', Validators.required], 'email': ['', Validators.compose([Validators.pattern("[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+&bso ...

Is it feasible to tailor the structure of the new application directory?

Recently, I was assigned a task to explore customizing the folder structure for new apps, specifically Nest apps. After some research, I discovered that it is possible to create a "lib" folder within the "tools" directory and leverage patterns to automatic ...

Using Tomcat as the backend server, Angular as the frontend framework, and

I am facing difficulties in consuming a tomcat POST service using an Angular front end. As I am relatively new to Angular, I may need some guidance. Here is my current environment: Tomcat 9.0 JDK 17 Angular 17 with standalone components javax.ws.rs framew ...

Tips on navigating to the next or previous variable reference in VS Code

While using TypeScript in VS Code, is there a similar shortcut like in Visual Studio for easily navigating between variable references within the open script? ...

checkbox with an option tag

I need help with implementing multi-select checkboxes inside an Angular 4 application. The checkboxes are not appearing next to the team names as intended. Can anyone assist me with this issue? Below is a snippet of my HTML code: <select class="form-c ...

Tips for displaying the string value of an elementFinder when encountering an error in protractor

I have the following code snippet: export async function waitTillClickable(e: ElementFinder): Promise<ElementFinder> { const conditions = EC.visibilityOf(e); await browser.wait(conditions, DEFAULT_TIMEOUT, `Element did not return ...

Add a new value to the translation token using ng-bind

I'm attempting to loop through an element 5 times using ng-repeat and track by $index. Following that, I aim to utilize the value from $index to supplement a translation token. This appended index value corresponds with the token which retrieves the a ...

Challenge with JWT Tokens

In my application, I am utilizing a Node.JS express backend along with an Angular 4 frontend. The user ID is stored in JWT tokens, which do not expire. Here is the scenario: The user logs in. A JWT Token is generated and signed (containing the user ID). ...

The property 'label' is not found in the 'string' type in Typescript

Below is the code snippet I am using: interface State { resourceGroup: QuickPickItem | string; } setEvent(state.resourceGroup?.label).catch(err => console.error(err)); When executing this code, I encountered the following error messa ...

Dealing with challenges in integrating ngx-masonry with Angular 14

I am currently working with Angular 14 framework and the ngx-masonry library (https://www.npmjs.com/package/ngx-masonry/v/14.0.1). However, I am facing some issues where it is not functioning correctly. I would appreciate any assistance or guidance on how ...

Unable to link to '' because it is not recognized as a valid attribute of '' in Angular 2

I encountered an exception while working on my Angular 2 project and I'm struggling to figure out the cause. Below is the snippet of my code: ts: import {Component} from "@angular/core"; import {GridOptions} from "ag-grid"; import {RedComponentComp ...

TypeScript error: Attempting to utilize an argument of type 'any[]' that cannot be assigned to a parameter of type 'SetStateAction<never[]>'

In my React app built with TypeScript, there is a specific section where I need to merge a predefined set of default users with negative userIds and other users fetched using the getUsers(orgId) API. Here's the code snippet: .... const [assigned ...

Universal Module Identifier

I'm trying to figure out how to add a namespace declaration to my JavaScript bundle. My typescript class is located in myclass.ts export class MyClass{ ... } I am using this class in other files as well export {MyClass} from "myclass" ... let a: M ...

Migrating the Angular application from version 4.x.x to 6.0

I am currently working on a large open source project built on Angular 4. The project has many components and I am facing challenges in updating it to Angular 6. Even though the official site https://update.angular.io/ provides guidance, manually searchi ...

The Ionic tab is already finished displaying even before the data has completed loading

Creating a favorites section for a vouchers app has proven to be slightly challenging. When attempting to retrieve the current user's favorite vouchers and display them using ngFor in the HTML, I encountered an issue. The very first time I open the fa ...