Custom Datasource Api - Label and Value Filtering

Answered
Henry asked on February 3, 2021

Hello,
 
In the jsFiddle under the demos, we were inspecting the responses of the /select requests when filters are being applied and we had some observations that we were not sure of. We've prepared a video and jsFiddle to show our observations:

  • What we observed was that if we first apply a value filter, then the response contains data that meets the filtering criteria. However, if we first apply a label filter, then a value filter, the response includes data that does not meet the filtering criteria; the pivot table, however, only shows the data that meets the filter criteria. So we were wondering if there are cases where we should be responding with data that does not meet the filter criteria, and if there are, what are the prerequisite for such cases?
  • As a side note, in our Custom Datasource implementation, we respond with data that meets the filter criteria. In doing so, however, then when we apply a label filter and a value filter, we start to see "Cannot read property '0' of undefined" errors in our console. If we respond with data that does not meet the filter criteria, then the errors do not appear. So we were not sure if the errors were caused by our implementation or if there was a bug in how the Pivot Table handles filtered data. We are using 2.8.20 if it is of any help.

 
Kind regards,
Henry

Attachments:
console-error.PNG

8 answers

Public
Milena Pechura Milena Pechura Flexmonster February 4, 2021

Hello, Henry!
 
Thank you for writing to us and for providing an example, video, and a screenshot.
 
We have carefully checked the reported behavior on our side. Indeed, in such a scenario the response contains extra data. It happens when several filters are applied together.
 
In your custom data source API implementation, there is no need to respond with data that does not meet the filter criteria.
Speaking of the error in the console, we will investigate this question and get back to you with the result of our research.
 
Please let us know if any other questions arise.
We will be glad to help you.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster February 5, 2021

Hi, Henry,
 
Our team has tested the behavior you described to see if the error appears on our side too.
Please find detailed info about our investigation below.
 
To simulate the custom data source API implementation, we specified the url property of the dataSource as a function, which returns responses depending on the request type and query.
Please see the following example: https://jsfiddle.net/flexmonster/ksfhjoa2/.
 
On 250-845 lines in the JS box, we coded the logic of responses to the /select requests, namely:

  • request for the data filtered by Accessories
  • request for the data filtered by Accessories and Color value filter (greater than 30 000)
  • other requests (in this case we respond with unfiltered data).

The following steps have been tested via UI:

  1. Open Category filter pop-up
  2. Deselect all
  3. Select Accessories, apply filter
  4. Open Color filter pop-up
  5. Open values filter
  6. Specify "Greater than 30 000", apply filter.

Getting to the point, please have a look at the code on 421-492 lines. The data in response meets filtering criteria. There is also a commented code of response that does not meet filtering criteria.
On our side, we have not noticed any errors in the console.
 
Please note that our team has also tested this example using the 2.8.20 version of Flexmonster.
 
Do not hesitate to contact us in case you have any questions regarding the example above.
Also, please let us know if you can modify the example to reproduce the issue or if the question is already solved.
 
Kind regards,
Milena

Public
Henry February 5, 2021

Hi, Milena,
 
Thank-you for providing a thorough investigation! We actually had a difficult time reproducing the error again on our side, but after some digging, we found a very peculiar way of reproducing it - we've prepared a new fiddle and video for convenience:

  • In order to reproduce the error, the following conditions must be met regardless of the order in which they are applied:
    1. The pivot table has a configured hierarchy in either the rows or columns
    2. There is at least one cell that is conditionally formatted.
    3. There is a set of filters such that when applied, there is only one row and one column in the resulting pivot table.
  • If at least one of those conditions are not met, then the error does not occur. 
    1. jsFiddle
    2. Video

 
Kind regards,
Henry

Public
Milena Pechura Milena Pechura Flexmonster February 8, 2021

Hello, Henry,
 
Thank you for researching the case further and for providing the video and the example.
 
The fix for the error is going to be provided with the minor update ETA 8 March.
We will notify you as soon as the version with the fix is available to download.
 
Do not hesitate to contact us if you have any questions.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster March 9, 2021

Hi, Henry,
 
We are pleased to inform you that the exception when setting conditional formatting with specific filters was fixed.
This is available in the 2.8.28 version of Flexmonster: https://www.flexmonster.com/release-notes/.
 
You are welcome to update the component.
Here is our updating to the latest version guide for assistance:
https://www.flexmonster.com/doc/updating-to-the-latest-version/.
 
Please contact us in case any questions arise.
 
Kind regards,
Milena

Public
Henry March 9, 2021

Hi, Milena,
 
Thanks again to you and the team!
 
Kind regards,
Henry

Public
Milena Pechura Milena Pechura Flexmonster March 18, 2021

Hello, Henry,
 
Our team would like to kindly take an interest in whether you updated to the latest version.
If so, could you please confirm that everything works as expected?
 
Looking forward to hearing from you.
 
Best regards,
Milena

Public
Henry March 18, 2021

Hello, Milena,
 
Yes, we've updated to the latest version and have confirmed that the error no longer appears. Thanks much to you and the team!
 
Kind regards,
Henry

Please login or Register to Submit Answer