PivotGrid Hyperlink

Hello, and thanks in advance.

looking at ASP.NET Core Pivot Grid documentation for hyperlink functionality (here), it's not clear to me how to properly implement the functionality.

Would it be possible to provide a simple example?

5 Replies 1 reply marked as answer

SS Saranya Sivan Syncfusion Team November 12, 2020 01:48 PM UTC

  
Hi Rui Mendes, 
  
We would like to inform that the requirement can be achieved through the Hyperlink feature by setting  
“showHyperlink” to true. Please check the below UG and Sample link below for your reference. 
  
  
  
We hope the above sample meets your requirements. Please let us know if you have concern. 
  
Regards, 
Saranya Sivan. 
 



RM Rui Mendes November 12, 2020 05:46 PM UTC

Many thanks.

In fact the fundamental doubt is how one would handle the triggered event, as per the documentation:

<ejs-pivotview id="PivotView" height="300" hyperLinkCellClick="hyperlink")

Event

The event hyperlinkCellClick fires on every hyperlink cell click.

It has following parameters - cancel and currentCell. The parameter currentCell is used to customize the host cell element by any means. Meanwhile, when the parameter cancel is set to true, applied customization will not be updated to the host cell element.


Many Thanks in advance.


ME Mouli Eswararao Syncfusion Team November 13, 2020 07:59 AM UTC

Hi Rui Mendes,

We can trigger the hyperlink cell click event by defining the event in the script tag in the cshtml file, where you can customize the hyperlink event based on your requirements. We have also prepared a sample with hyperlink cell click event and attached it for your reference.
 
Code: 
<script> 
    function onCellClick(args) { 
        //Here you can customize the hyperlink based on the current cell information(can be found in args.data) 
        if (args.currentCell.querySelector('a') && 
            (args.currentCell.querySelector('a').innerText === 'France' || args.currentCell.querySelector('a').innerText === 'Germany')) { 
            var country = args.currentCell.querySelector('a').innerText; 
            args.currentCell.querySelector('a').setAttribute('data-url', (country === 'France' ? 
                'https://en.wikipedia.org/wiki/France' : 'https://en.wikipedia.org/wiki/Germany')); 
            args.cancel = false; 
        } else if (args.currentCell.querySelector('a')) { 
            args.currentCell.querySelector('a').setAttribute('data-url', 'https://www.google.com/'); 
            args.cancel = false; 
        } 
    }; 
</script> 
 
 

Regards,
Mouli
 


Marked as answer

RM Rui Mendes November 16, 2020 08:12 PM UTC

Dear Sirs,

Many thanks for your excellent support.

I stand clarified.


SS Saranya Sivan Syncfusion Team November 17, 2020 05:47 AM UTC

Hi Rui Mendes, 
 Please let us know if you have any other queries . We are always happy to assist you. 
Regards, 
Saranya Sivan. 


Loader.
Up arrow icon