server side script image
server side script image
joon49
Posts: 12Questions: 2Answers: 0
Hi,
I would like to display the line info in a modal form by clicking on the image.
but i don't know how i should proceed?
Can you help me please?
Thanks in advance.
array('db' => 'image', 'dt' => 1, 'formatter' => function( $d, $row ) {
return "<img class='essai' src='$d' data-id='.$row['id'].' style='height:50px;width:50px;'/>";
})
This question has an accepted answers - jump to answer
Answers
Use a renderer to create a link, and then add an event listener to the link so that when clicked on it would call whatever modal library you are using to display the image.
Allan
I would like display all row's info not only the image
Use
row().data()
to get the data for the row and draw that into your modal in that case.Allan
the problem is that the function table.row(this).data(); do not work.
I'm on server side processing.
I do not know why?
Can you help me please?
Is
this
the image you clicked?You might need to get the closest
td
ortr
to pass intorow()
. See therow-selector
docs for all the options. For example:Kevin
row().data()
will work just fine with server-side processing enabled. If Kevin's reply doesn't help you resolve this, please link to a test case showing the issue so we can offer some help.Allan
I can't solve the problem.
https://jsbin.com/qowicus/edit?html,css,js,console,output
I'm not clear how that shows the issue? When you click on a row, it dumps the data from the row onto the browser's console. That seems correct to me.
Allan
I find the error
var table = $('#table_list').DataTable(); instead of
var table = $('#table_list').dataTable();
The lowercase letter "d" doesn't work.
how to retrieve the data and put them in different variables like
var data1 = cell 1value etc..
You can use
row().data()
and specify the specific element from the data that you want. Another option is to usecell().data()
.Kevin