Data reload after column change

In my Grid, I need to diosplay different columns depending on the data (If the rows are all from the same subtype, I need to have more columns).

For data loading, I use a DataManager with a custom adaptor that overwrites the processResponse method and updates the columns according to the loaded data.

class ProductsAdaptor extends WebApiAdaptor{

  processResponse(data: DataResult) {
    //update columns
    return data;
  }
}

Now, after the column update, the data is loaded again, which, in turn, triggers a column update and so on in a vicious circle.

Is there a way to brak the circle or one to achieve the goal to adapt the columns to the data in another way?



1 Reply

MS Manivel Sellamuthu Syncfusion Team July 15, 2021 01:11 PM UTC

Hi Thomas, 

Greetings from Syncfusion support. 

Based on your query you are updating the Grid columns after receiving the data in the processResponse method of  the Custom Adaptor. By default changing the Grid columns will cause the Grid refresh. 
To avoid this we suggest you to use the Flag variable for updating the columns to prevent the column update again. 

class ProductsAdaptor extends WebApiAdaptor{ 
  processResponse(data: DataResult) { 
// use the flag variable here 
    //update columns 
// set the flag as false once updated the columns 
    return data; 
  } 
} 


To proceed further we request you to share the complete Grid code and custom adaptor code. 

Regards, 
Manivel 


Loader.
Up arrow icon