Author Topic: render function with <a href> problem  (Read 3288 times)

noctrona

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
render function with <a href> problem
« on: March 31, 2014, 09:19:21 pm »
Hi,

I have a row used render function to generate a hyper link to other page. Please have a look with my current js codes, and it works well.

Code: [Select]
{ title: "Line Item Status", width: 64,align: "center",editable: false,dataIndx: "status",
   render: goPR                     
}

The goPR function:
Code: [Select]
    var goPR = function(ui){
        var rowData = ui.rowData
            dataIndx = ui.dataIndx;
        var val = rowData[dataIndx];
        var pppId = rowData['Id'];
        //var link1 = "<a href='#' onclick='goToPR("+pppId+");return false;'>"+val+"</a>";
        var link2 = "<a href='/apex/PartnerPriceRequest?ppid="+encodeURIComponent(pppId)+"' >"+val+"</a>";
        return link2;
    }

As you see, if I return link2 which set a link in href directly, I can click my "val" value and go to the target page with parameter.
But if I change to link1 try to invoke another js function when I click this link, I got the error message like "pppId" value(like 0ax1212312) is not defined.

So do you know why this happened?


Thank you!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: render function with <a href> problem
« Reply #1 on: March 31, 2014, 09:28:03 pm »
pppId looks defined in the code.

A jsfiddle could be more useful to find out what's going on.
« Last Edit: March 31, 2014, 09:31:31 pm by paramquery »