Trying to get 2 variables in one column

Trying to get 2 variables in one column

forrustforrust Posts: 2Questions: 1Answers: 0
edited May 2014 in DataTables 1.9

Hello, i've been trying to get this to work, but my lack of knowledge is giving me a head ache... Does someone knows how to achieve the following:

i want to draw a button in the "bekijk" column with two profile_id's (init and init2), because i'm very new with data tables i have absolutly no clue how to achieve this.... ofcourse the statement below is drawing two columns, I want it to be in one column with the two [VAL] statements in one link... is this even possible?

Thanks in prosper

   $config['aColumnsin'] =  array('b.mod_name as m_name', 'c.profile_name as mfrom', 'd.profile_name as mto', 'e.message as cnr','a.cron as ts',  'c.profile_id as init', 'd.profile_id as init2' );
$config['aColumnsout'] = array('m_name', 'mfrom', 'mto', 'cnr','ts','init', 'init2' );
$config['sIndexColumn'] = "a.moderator_id ";
$config['searchable'] = array(1);
$config['sTable'] = " moderator_data a LEFT JOIN moderator b on a.moderator_id = b.moderator_id  LEFT JOIN user_profiles c on a._from = c.profile_id LEFT JOIN user_profiles d on a._to = d.profile_id LEFT JOIN messages e on a.message_id = e.message_id ".$clause;
$config['aConfig']['init']= '<a href="../admin/chatscherm?profile=[VAL]&to=" class="btn btn-mini"><i class="icon-share"></i> Bekijk</a>';
     $config['aConfig']['init2']= '<a href="../admin/chatscherm?profile=&to=[VAL]" class="btn btn-mini"><i class="icon-share"></i> Bekijk</a>'; 

Answers

  • allanallan Posts: 61,609Questions: 1Answers: 10,089 Site admin

    Perfectly possible. Personally I'd do it using columns.render rather than doing in PHP, but it should be perfectly possible there as well.

    Allan

  • forrustforrust Posts: 2Questions: 1Answers: 0
    edited May 2014

    Thanks for your quick reply! I am currently at DT1.9... need this to work though.. i've looked into columns.render, but dont see a solution..

    i've posted my jquery, any thoughts? thnx

    $('.data-table').dataTable({ "aaSorting": [[ 4, "desc" ]], "bJQueryUI": true, "bProcessing": true, "bServerSide": true, "sPaginationType": "full_numbers", 'sAjaxSource':'../controller/ajax.php?manage-outbox-moderator=yes', "sDom": '<""l>rt<"F"fp>' });

  • tangerinetangerine Posts: 3,348Questions: 36Answers: 394

    Start by defining your columns. Look at the examples here:

    http://datatables.net/reference/option/columns.render

This discussion has been closed.