how to make link with data from json datasource ..?

how to make link with data from json datasource ..?

yusmanyusman Posts: 1Questions: 1Answers: 0
edited November 2014 in Free community support

Dear All, i am new in datatables, i try to make link with data from datasource but i still cannot do that, any one can help me ?
this is my table

<table id="example" class="table table-condensed table-striped">
                          <thead>
                        <tr>
                            <th>ID</th>
                            <th>TITLE</th>
                            <th>CLASS</th>
                            <th>LEVEL</th>
                            <th>AUTHOR</th>
                            <th>PUBLISH YEAR</th>
                           <th>LINK</th>
                        </tr>
                        </thead>
                    </table>

and this is my book.json data

[
{"id":"1","title":"ABI Asiknya Belajar IPA","class":"1","level":"SD","author":"Evi susanti Sholehudin","publish_year":"2008","file_name":"ABI_Asiknya_Belajar_IPA_Kelas_1_Evi_Susanti_Sholehudin_2008","update_by":"120","time_stamp":"1415490685"},
{"id":"2","title":"Aku Bisa Bahasa Indonesia","class":"1","level":"SD","author":"Yeti Nurhayati","publish_year":"2009","file_name":"Aku_Bisa_Bahasa_Indonesia_Kelas_1_Yeti_Nurhayati_2009","update_by":"120","time_stamp":"1415490685"},
{"id":"3","title":"Bahasa Indonesia","class":"1","level":"SD","author":"Dian Sukmawati Endang Rahmat Denny Iskandar","publish_year":"2009","file_name":"Bahasa_Indonesia_Kelas_1_Dian_Sukmawati_Endang_Rahmat_Denny_Iskandar_2009","update_by":"120","time_stamp":"1415490685"}
]

this is my javascrip code

$('#example').dataTable( {
                    "ajax": {
                    "url": "book.json",
                    "dataSrc": "",
                    "columns": [
                     { "data": "id","sWidth":"30px","sClass": "center", },
                        { "data": "title" },
                        { "data": "class" },
                        { "data": "level" },
                        { "data": "author" },
                        { "data": "publish_year" },
                     // this is what i want to do .. make href link like this http://myserver.com/level/class/author/id/file_name
                     {"data":"<a href='http://myserver.com/"+level+"/"+class+"/"+author+"/"+id+"/"+file_name+" '>read more</a>"}
                    ]
                }

my question is how to make link like this <a href='http://myserver.com/"+level+"/"+class+"/"+author+"/"+id+"/"+file_name+" '>read more</a> and add to LINK column in every row

thank you, i appreciate for any help.
and sorry for my bad english :)

Answers

This discussion has been closed.