Need a special offer?Find out if your project fits.
+

Row Select Event

Answered
Nivedita asked on January 22, 2021

Hi Team,
We are using the "Flat" table in our application.
We have a requirement in our application where we need to get the event for the entire row selection. Is there a way to achieve this? 

3 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster January 22, 2021

Hello,
 
Thank you for posting on our forum.
 
Flexmonster does not provide the possibility to track the entire row selection by default.
 
However, you can try using the following workaround:
Every time Flexmonster throws the cellclick event, check if the getSelectedCell method returns the same set of fields as specified in the current Slice object.
We have prepared the JSFiddle to demonstrate this approach: https://jsfiddle.net/flexmonster/otbh6Lx2/.
 
Please note that this implementation is only developed for the demonstration. You may need to change or complement it to fit your specific needs.
 
Please let us know if it works for your case.
Our team is looking forward to hearing from you.
 
Kind regards,
Illia

Public
Nivedita January 26, 2021

Hi Illia,
Thanks for your response. PFA the screenshot for the use case I'm trying to achieve.
When I click on a checkbox for a row, I want to get the values of all the columns in that particular row as I need to perform some computation using the multiple values in different columns for that row.
Is there a way that I can get the information for that entire row?
 
thanks,
Nivedita
 

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster January 28, 2021

Hello,
 
Thank you for providing the details.
 
We suggest iterating over columns of the chosen rows using the getCell API call. It allows retrieving values of the chosen cell. Next, these values can be used to perform the desired computations.
This method takes two parameters:

  • rowIdx – Number. The index of the row.
  • colIdx – Number. The index of the column.

 
The way to determine the index of the chosen row depends on the checkboxes implementation.
In its turn, the number of columns displayed on the grid can be retrieved using the approach provided earlier: https://jsfiddle.net/flexmonster/otbh6Lx2/.
Please see the getAllUniqueNames function from the JSFiddle for reference.
 
Another approach is to use an additional field of the id data type in your data set. It would allow determining what specific record was chosen and select it from the initial data set by the id.
More about the id datatype and the way to specify it can be found in our documentation.
 
We hope it helps.
Please contact us in case other questions arise.
 
Kind regards,
Illia

Please login or Register to Submit Answer