how to make object of DT_RowData or DT_RowAttr

how to make object of DT_RowData or DT_RowAttr

abidabid Posts: 3Questions: 1Answers: 0
$records["data"][] = array('DT_RowId'=>'row_record_id_'.$row['invoice_id'],'DT_RowClass'=>$dublicateClass, 'DT_RowData' => { 'onclick': 'anyFunctionName()'},$value1,$value2,$value3,$value4,$value5,$value6,$value7,$value8);

Answers

  • abidabid Posts: 3Questions: 1Answers: 0

    this is example of my code please tell me who i insert DT_RowData or DT_RowAttr in this code
    <code> $records["data"][] = array('DT_RowId'=>'row_record_id_'.$row['invoice_id'],'DT_RowClass'=>$dublicateClass, 'DT_RowData' => { 'onclick': 'selectRow('.$row['invoice_id'].')'},$value1,$value2,$value3,$value4,$value5,$value6,$value7,$value8);

    </code>

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin

    'DT_RowData' => { 'onclick':

    That isn't valid PHP. Is it not giving you an error?

    You need to construct an associative array like you have done for the container array.

    Allan

  • abidabid Posts: 3Questions: 1Answers: 0
    edited July 2015

    i used this and working fine but i changed datatables js file then its becomes fine

            if ( data.DT_RowAttr ) {
                //$(tr).attr( data.DT_RowAttr ); old line of code
                                $.each(data.DT_RowAttr, function (i, val) {
                                    $(tr).attr(i,val)
                                })
            }
            if ( data.DT_RowData ) {
                //$(tr).data( data.DT_RowData );old line of code
                                $.each(data.DT_RowData, function (i, val) {
                                    $(tr).attr(i,val)
                                })                                
            }
    

            $dublicateRowTitle = array('data-original-title'=>' Your Fakturanr is repeating ' . $dublicate . ' times','data-toggle' => 'tooltip');
        $records["data"][] = array('DT_RowId'=>'row_record_id_'.$row['invoice_id'],'DT_RowClass'=>$dublicateClass,'DT_RowAttr'=>$dublicateRowTitle,$value1,$value2,$value3,$value4,$value5,$value6,$value7,$value8);
    
This discussion has been closed.