Get Free Trial

pivot.updateData() with empty set

Paul Pollard asked on October 17, 2018

I’m making use of pivot.updateData() and, depending on user filters, sometimes no data is returned. However, if “[]” is returned, flexmonster doesn’t update (it will keep the previous data in the table). I’ve tried using:

  1. pivot.clear();
  2. pivot.setReport({});

Both of these “work” (as in they reset the table), but it also resets all other configuration (such as custom slices).
Is there a way to keep the custom slice (headers etc) but display no data?

1 answer

Tanya Gryshko Tanya Gryshko Flexmonster October 19, 2018

Hello, Paul,
When the updateData API call is used, the component tries applying the current slice to the new data source. If this is not possible, a new slice is set. For example, run pivot.updateData({data: [{}]}) and, as the current slice is not applicable to this empty data, you will see an empty Field List.
If you want to keep the custom slice (headers etc) but display no data, simply add headers to your updateData call. Example:

  data: [{
    Customer: {type: "string"}, 
    Month: {type: "string"}, 
    Revenue: {type: "number"}

Find out more different types of headers:
Hope it helps.

Please login or Register to Submit Answer