Laravel 4의 Chumper 's Data 테이블을 사용하여 테이블에 클래스 또는 ID를 추가하여 CSS 및 JS를 추가 할 수있는 방법은 없지만 그물 검색은 시도했지만 아무도 나에게 직접적인 대답을 제공하지 않습니다. 여기클래스 또는 ID를 Chumper Data Table에 추가하는 방법은 무엇입니까?
내 (작업) 코드 :
public function getSales()
{
$sales = DB::table('tblsaleshistory')
->select('ordered_by',DB::raw('sum(salesTotal) as st, count(ordered_by) as sell'))
->groupBy('ordered_by');
return Datatable::query($sales)
->addColumn('Name',function($model)
{
$html = $model->ordered_by;
return $html;
})
->addColumn('data',function($model)
{
$salesTotal = $model->st;
return $salesTotal;
})
->addColumn('%',function($model)
{
$percentage = "<span id='pa-".$model->ordered_by."'>".($model->st/5000)*100 ."</span>";
return $percentage;
})
->addColumn('sell',function($model)
{
$sell = $model->sell;
return $sell;
})
->searchColumns(array('ordered_by','sell','st'))
->orderColumns('st')
->make();
}
내보기 :
{{ HTML::script('js/dataTable/jquery.datatable.js') }}
<?php echo HTML::flash(); ?>
{{ Datatable::table()
->addColumn('PA','Total Sales','%','Sales Count') // these are the column headings to be shown
->setUrl('api/getSales') // this is the route where data will be retrieved
->render();
}}