Articles in this section
Category / Section

How to provide relative url in Spreadsheet hyperlink

2 mins read

This knowledge base explains how to provide relative URL in Spreadsheet hyperlink.

 

It can be achieved by setting the “target” property in argument of client side “cellClick” event. So, we are able to navigate the hyperlink based on the provided target.

 

[HTML]

 

$("#Spreadsheet").ejSpreadsheet({
        sheets: [{
                    rangeSettings: [{ dataSource: dataSource}],
                }],
        loadComplete: "loadComplete",
        cellClick: " cellClick", 
});

 

[JS]

 

function loadComplete(args) {
          if(!this.isImport){
               this.XLFormat.format({ "style": { "font-weight": "bold" } }, "A1:C1");
    this.setWidthToColumns([110, 610]);
               this.setHyperlink("A2", { "webAddr": "/#!/bootstrap/spreadsheet" }, 1);
               this.setHyperlink("A3", { "webAddr": "/#!/bootstrap/grid" }, 1);
               this.setHyperlink("A4", { "webAddr": "/#!/bootstrap/treegrid" }, 1);
               this.setHyperlink("A5", { "webAddr": "/#!/bootstrap/chart" }, 1);
 }
        }
function cellClick(args) {
         if (args.action == "hyperlinkclick" && args.rowIndex < 5 && args.colIndex == 0) { 
                 args.webAddr = "https://js.syncfusion.com/demos/jquery" + args.webAddr; // option for setting the web address 
                 args.target = "_self"; // To open in same window 
           } 
        }

 

The following output is the result of above code example in spreadsheet.

 

Spreadsheet Hyperlink

 

Demo Sample:

https://www.syncfusion.com/downloads/support/directtrac/general/ze/sample553097839

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied