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

Grid Icon click handler

Answered
Tanushree asked on February 2, 2021

Hello Team,
Is there a way we can handle the grid icon click event?
I currently need to invoke refresh() after showGrid() api call when Grid icon is clicked.
The challenges I'm facing are:

  1. Attaching an appropriate listener (cellclick only works when clicked on any cell/header but doesn't handle grid icon click events)
  2. Taking custom action once Grid icon is clicked - After showGrid() I need to invoke refresh() api.

It's even tricky in our case as we have multiple Flex Monster grids on same screen for multiple reports and need to find a way to listen to grid click events in appropriate FM container and take action.
Thanks,
Tanushree

3 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster February 3, 2021

Hello,
 
Thank you for contacting us.
 
If we understand correctly, you require this functionality to remove the blank space appearing under the grid as described within the following thread: https://www.flexmonster.com/question/empty-space-at-the-bottom-when-grid-icon-clicked/.
In this case, we suggest checking out the mentioned thread to learn the possible reason for this behavior.
 
If the workaround with refresh API call is still needed, please see the explanation below.
You can overwrite the default handler of the "Grid" button in order to add custom functionality.
For example:

pivot.on("beforetoolbarcreated", (toolbar) => {
  let tabs = toolbar.getTabs();
  toolbar.getTabs = () => {
  	let gridTab = tabs.filter(tab => tab.id == "fm-tab-grid")[0];
    gridTab.handler = () => {
    	pivot.showGrid();
      pivot.refresh();
    }
    return tabs;
  }
});

 
See the JSFiddle we have prepared for the demonstration: https://jsfiddle.net/flexmonster/63h91q70/.
 
Please let us know if it helps.
Our team is looking forward to hearing from you.
 
Regards,
Illia

Public
Tanushree February 9, 2021

Thanks Illia for your response.
I did try adding a custom handler but this didn't work.
In fact, after adding custom handler for Grid click, showGrid() api is not called at all now and therefore refresh() doesn't get called as well.
Is there a better way to handle Flex Monster to re-size correctly through javascript?
Thanks,
Tanushree

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster February 11, 2021

Hello,
 
We want to kindly draw your attention to the mentioned JSFiddle that demonstrates the recommended way to specify this handler: https://jsfiddle.net/flexmonster/63h91q70/.
 
If it does not help, please modify the JSFiddle to demonstrate the issue.
 
Regards,
Illia

Please login or Register to Submit Answer