server side script image

server side script image

joon49joon49 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

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    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

  • joon49joon49 Posts: 12Questions: 2Answers: 0

    I would like display all row's info not only the image

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Use row().data() to get the data for the row and draw that into your modal in that case.

    Allan

  • joon49joon49 Posts: 12Questions: 2Answers: 0

    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?

  • kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949

    Is this the image you clicked?

    You might need to get the closest td or tr to pass into row(). See the row-selector docs for all the options. For example:

    var td = $( this ).closest( 'td' );
    var data = table.row( td ).data();
    

    Kevin

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    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

  • joon49joon49 Posts: 12Questions: 2Answers: 0
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    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

  • joon49joon49 Posts: 12Questions: 2Answers: 0

    I find the error

    var table = $('#table_list').DataTable(); instead of

    var table = $('#table_list').dataTable();

    The lowercase letter "d" doesn't work.

  • joon49joon49 Posts: 12Questions: 2Answers: 0

    how to retrieve the data and put them in different variables like

    var data1 = cell 1value etc..

  • kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949
    Answer ✓

    You can use row().data() and specify the specific element from the data that you want. Another option is to use cell().data().

    Kevin

Sign In or Register to comment.