We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

Record referemce in cellClick event for customdatasource pivot / flat mode

Answered
sedApta asked on September 11, 2024

Hi,

I'm implementing a feature using the pivot flat (both in json and custom data source) and in the cellClick event I need to have a reference to the clicked record. In the JSON data source the cell in input gives me the information about the recordId, that I can use to go back to the record (I use in the mapping a field tagged as id). But in the custom data source instead I have no reference. From your documentation the id field is indeed not supported in the custom data source. But without this information I cannot proceed with my implementation.
Could you please add, in the case of the pivot flat, the information about the clicked record (thus showing all the valued fields of the selected row) in both datasources (also in the JSON case in fact having reference directly to the record makes access much easier).
Even better: it would be nice to always have (not only for the flat, and for both datasources) a new parameter in the cellClick event that lists all the records ‘impacted’ by the selection. For the json data source you already have the client-side data; for the customDataSource it would be sufficient to trigger a filtered ‘select’ request in flat mode for the selected cell. Since this could lead to a performance drop (if this new parameter is not used) you could make it configurable whether or not to process this calculation.

Thanks in advance,
Ilaria

7 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster September 13, 2024

Hello Ilaria,

Thank you for reaching out to us.

You are correct that, currently, the id data type is only supported for "json" and "csv" data source types. Could you please provide us with more details on your use case? How do you want to use the reference to the clicked cell?

Looking forward to hearing from you.

Kind regards,
Nadia

Public
sedApta September 17, 2024

Hello Nadia,

thanks for your quick reply.
Here some details:

Having a mapping like:

 

        mapping: {
          "field1": {
            type: "string"
          },
          "measure1": {
            type: "number"
          },
          // ...
        }

I would like to have an event like this: 

        onCellClickWithData: (cell: Flexmonster.CellData, data: any[]): void => {
          data.forEach((rec)=>{
            console.log(data["field1"]);
            console.log(data["measure1"]);
          }
        },

so that I can access records underlying the clicked cell.
For the customDataSourceApi you can retrieve records by performing a 'select' request in flat mode, filtered by the clicked cell (plus other filters already applied to the pivot). 
For the json pivot, you shoud already have the information client side. 
We need this event in the flat pivot, but I think it should be nice to have the same event in all layout modes (classic, compact, flat).

Let me know if you need more details.

Thanks,
Ilaria

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster September 19, 2024

Hello Ilaria,

Thank you for the details and apologies for our delayed response.

We want to explain that the described use case is quite specific and not a common scenario we typically encounter. Our custom data source API is not designed to return IDs based on a cell click. For this reason, we recommend implementing this feature on your side.

The cellclick event returns the CellDataObject - object contacting information about the clicked cell. You can use the CellDataObject to retrieve the measure it relates to and the members of the fields at the intersection of the cell. Then, you can create a separate endpoint to send this data and retrieve the list of record IDs as required.

You are welcome to contact us if further questions arise.

Kind regards,
Nadia

Public
sedApta September 20, 2024

Hi Nadia,

the cellclick event does not return any information on the cell in the flat mode.

 

Kind regards,

Ilaria

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster September 23, 2024

Hi Ilaria,

Thank you for getting back to us!

We understand that the cellclick event on the flat view only provides part of the information to identify the exact record connected to the clicked cell. Our team would like to ask for further clarification. Please share more details about the feature or result you're trying to achieve by having the record IDs. Knowing your goal will help us find a better solution for you.

Looking forward to hearing from you.

Kind regards,
Nadia

Public
sedApta September 25, 2024

Hi Nadia,

the fact is that with customDatasourcApi the cell click event return information only on the selected column and no other information of the row. 
See the attached sample: I've a flat pivot showing sales data per customer/month (flatPivot.png). If I click on a month I can't retrieve the information to which customer refers the row (cellClick_customApi.png), and viceversa, if I click on a customer I dont'ave information on the month. Since the 'recordId' is null (because it'a customDatasourceApi) I need the list of values for the other columns of the clicked row in the cell click event

Best regards, 
Ilaria

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster September 25, 2024

Hi Ilaria,

Thank you for the response.

We agree that the record information on the cellclick event is somewhat limited for the flat view. We understand the importance of having the ability to get the record ID. Our team will research possible solutions and provide you with results ETA October 28th. Please note that our research will be for the flat view only.

You are welcome to contact us if other questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer