zepernick / Codeigniter-DataTables

CodeIgniter Library For Ajax Server Side DataTables 1.10 >
MIT License
93 stars 94 forks source link

Adding HTML through AJAX processing results #15

Open abydahana opened 9 years ago

abydahana commented 9 years ago

Hello. I was downloaded and implementing this library into my own application. It's works until I got confused then. You know, my table results should adding options to handle any rows. For example there is "User" table. So it's row should have option to manage user such "Edit", "View" or "Delete".

How to implements my idea? Is it can be done from model?

Thank you, Regards

abydahana commented 9 years ago

Ok, I'm done with this:

columns:[
  {
    data: null,
    defaultContent: '<span class="btn btn-info btn-edit btn-xs">Edit</span>',
    orderable: false,
    searchable: false
  },
  {data: "st_name"},
  {data: "st_address"},
  {data: "st_city"},
  {data: "st_state"},
  {data: "st_zip"},
  {data: "st_phone"}
]

But how to fetching a unique ID from database?

<a href="edit/st_phone"><span class="btn btn-info btn-edit btn-xs">Edit</span></a>

st_phone mean to getting unique phone from database results. It's should returning "edit/099123456". How do you can done with that?