how to put hyperlink to each column

how to put hyperlink to each column

kawinkawin Posts: 4Questions: 0Answers: 0
edited June 2011 in General
Dear everyone,

Please could anyone tell me where and how to put hyperlink
to column data so the data display in each row are clickable and linked to other page.
also if i can achieve this I would be able to insert any javascript event such as onclick into the hyperlink as well.

please help

Replies

  • mirkecmirkec Posts: 8Questions: 0Answers: 0
    [code]
    "mDataProp": "YourColumnData",
    "fnRender": function (oObj) {
    return '' + oObj.aData["property2"](LINK TEXT) + '';
    }
    [/code]

    In the example above, I put hyperlink into one column, and gave it text from other property say Item.ID, for column link(so you have Page/Edit/ID), and Item.Name for link text.
  • kawinkawin Posts: 4Questions: 0Answers: 0
    wow! thanks

    now i'm getting the idea of how to achieve this but I still cannot get it to work.
    please help me a bit more.
    can u please post the whole block of code so I could see where and how your sample code is applied.
    because I don't know where to insert your sample code?
    I'm very new to this.

    thanks again.
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    The code example in the documentation for fnRender shows how you can use mirkec's solution: http://datatables.net/usage/columns#fnRender .

    Allan
  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    if u getting your data from server

    you can simply put a link into each json array cell

    like this

    jsonArray.add(""+vName3+" ");
    jsonArray.add(""+vName3+" ");
    jsonArray.add(""+vName3+" ");
This discussion has been closed.