We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid only returning items in grid view

I am using Inline Editing using the toolbar with 'Add' 'Edit' 'Delete' 'Update'. This datasource for the grid is a using a service that responds with a list of objects based on a model.

The grid view includes accountName, userName and userPassword. And I am using 

(actionBegin)='actionBegin($event)'

When I 'add' a new item in the args response it does not return a new 'CredentialDto' item for the datasource but only returns only the items in the grid view. I thought args.data should be the items in the grid view but expected args.rowData should be a new instance of the 'CredentialDto' containing all the items from the model 

I am new to using this component so I may misunderstand how this should work. The goal is to get a new grid item based on CredentialDto.


export interface CredentialDto {

    id: string,

    accountNumber: string,

    userName: string,

    userPassword: string,

    accountName?: string,

    created_at?: string

    updated_at?: string

    deleted_at?: string

}





1 Reply

RS Rajapandiyan Settu Syncfusion Team February 20, 2023 12:43 PM UTC

Hi Thomas,


Thanks for contacting Syncfusion support.

In EJ2 Grid, while adding the data, the edit form is created only for predefined columns in Grid. So, in the actionBegin event (requestType as add), the args.data contains the value only for the predefined columns. This is the behavior of Grid. If you want to get all the fields of CredentialDto in the actonBegin event, you need to define all the columns in Grid settings.


By using the visible property of Grid column, you can show/ hide the particular column based on your requirement. Please refer to the below code example for your reference.


 

      <e-column field="id"  headerText="id"  width="120"  [isPrimaryKey]="true" [visible]="false"></e-column>

      <e-column field="accountNumber" [visible]="false" width="120"></e-column>

      <e-column field="userName" width="120"></e-column>

      <e-column field="userPassword" width="120"></e-column>

      <e-column field="accountName" width="120"></e-column>

      <e-column field="created_at" [visible]="false" width="120"></e-column>

      <e-column field="updated_at" [visible]="false" width="120"></e-column>

      <e-column field="deleted_at" [visible]="false" width="120"></e-column>

 


Regards,

Rajapandiyan S


Loader.
Up arrow icon