Search code examples
syncfusion

Syncfusion hyperlink in ejgrid column


Does anyone know how I can add a hyperlink to the Username column in my code below?

$("#ManagerApprovalGrid").ejGrid({
                        dataSource: data,
                        isResponsive: true,
                        allowScrolling: true,
                        allowFiltering: true,
                        allowSorting: true,
                        columns: [
                            { field: "userDispName", headerText: 'Timesheet User', textAlign: ej.TextAlign.Left, width: 20}, 
                            { field: "weekEndDate", headerText: 'Week End Date', textAlign: ej.TextAlign.Center, width: 20 }

                        ]

                    });

Thanks Dee


Solution

  • Refer to the below knowledge base to place hyperlink in ejGrid.

    https://www.syncfusion.com/kb/3767

    Update

    The ejGrid uses JSRender template to render its content. So you can do like below to pass the parameter to the hyperlink.

    $("#ManagerApprovalGrid").ejGrid({
                       . . . . . 
                        columns: [
                           { 
                             field: "userDispName", 
                             template:"<a href=something/{{:userDispName}}>View</a>" 
                             headerText: 'Timesheet User',
                             textAlign: ej.TextAlign.Left, width: 20
                          }, 
                           . . . . 
    
                        ]
    
                    });
    

    Demo: http://jsplayground.syncfusion.com/nvoeeoel