2
私はwebform上のアーカイブ用にdatatables jqueryプラグインを利用しています。私のjavascriptは次のとおりです:PHP/JQUERY - カラムのデータのハイパーリンクを作成する
<script type="text/javascript" language="javascript" src="js/jquery.js"</script>
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript" src="jquery-ui.js"</script>
<script type="text/javascript" language="javascript" >
$(document).ready(function() {
var dataTable = $('#employee-grid').DataTable({
"scrollY": 500,
"scrollX": true,
"processing": true,
"serverSide": true,
"ajax":{
url :"employee-grid-data.php", // json datasource
type: "post", // method , by default get
error: function(){ // error handling
$(".employee-grid-error").html("");
$("#employee-grid").append('<tbody class="employee-grid-error"><tr><th colspan="3">No data found in the server</th></tr></tbody>');
$("#employee-grid_processing").css("display","none");
}}
});
});
</script>
表は完全に動作しています。ユーザがより多くの詳細を表示することができ、「変更ID」フィールドに、テーブルデータに
`<a href="admin_change_details.php?changeid=' . $row['change_id'] . '"title=Details>' . $row['change_id'] . '</a>`
:問題は、私は、ハイパーリンクをつけたい、です。
<?php
include 'config.php';
$requestData= $_REQUEST;
$columns = array(
0 =>'change_id',
1 =>'customer_name',
2 => 'change_requestor',
3=> 'date_cr_raised',
4=> 'person_to_complete_change',
5=> 'cpm_ticket',
6=> 'out_of_hours',
7=> 'category_of_change',
8=> 'requestor_impact',
9=> '',
10=> 'approval_disposition',
11=> 'approval_date',
12=> 'approval_impact',
13=> 'approval_name',
14=> 'approval_expiry_date',
15=> 'status_requested',
16=> 'date_status_requested',
17=> '',
18=> 'review_change_success',
19=> 'review_change_date',
20=> 'review_nable',
21=> 'review_date',
22=> 'review_by',
23=> '',
24=> 'closed',
25=> 'closed_by',
26=> 'closed_date'
);
$sql = "SELECT * ";
$sql.=" FROM change_request_tbl";
$query=mysqli_query($conn, $sql) or die("employee-grid-data.php: get data");
$totalData = mysqli_num_rows($query);
$totalFiltered = $totalData;
$sql = "SELECT * ";
$sql.=" FROM change_request_tbl WHERE 1=1";
if(!empty($requestData['search']['value'])) {
$sql.=" AND (change_id LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR customer_name LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR change_requestor LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR date_cr_raised LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR person_to_complete_change LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR cpm_ticket LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR out_of_hours LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR category_of_change LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR requestor_impact LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR approval_disposition LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR approval_impact LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR approval_name LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR approval_date LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR approval_expiry_date LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR status_requested LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR date_status_requested LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR review_date LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR review_change_date LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR review_by LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR review_change_success LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR review_nable LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR closed LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR closed_by LIKE '".$requestData['search']['value']."%' ";
$sql.=" OR closed_date LIKE '".$requestData['search']['value']."%')";
}
$query=mysqli_query($conn, $sql) or die("employee-grid-data.php: get data");
$totalFiltered = mysqli_num_rows($query);
$sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." ";
$query=mysqli_query($conn, $sql) or die("employee-grid-data.php: get data");
$data = array();
while($row=mysqli_fetch_array($query)) {
$nestedData=array();
$nestedData[] = $row["change_id"];
$nestedData[] = $row["customer_name"];
$nestedData[] = $row["change_requestor"];
$nestedData[] = $row["date_cr_raised"];
$nestedData[] = $row["person_to_complete_change"];
$nestedData[] = $row["cpm_ticket"];
$nestedData[] = $row["out_of_hours"];
$nestedData[] = $row["category_of_change"];
$nestedData[] = $row["requestor_impact"];
$nestedData[] = $row[""];
$nestedData[] = $row["approval_disposition"];
$nestedData[] = $row["approval_date"];
$nestedData[] = $row["approval_impact"];
$nestedData[] = $row["approval_name"];
$nestedData[] = $row["approval_expiry_date"];
$nestedData[] = $row["status_requested"];
$nestedData[] = $row["date_status_requested"];
$nestedData[] = $row[""];
$nestedData[] = $row["review_change_success"];
$nestedData[] = $row["review_change_date"];
$nestedData[] = $row["review_nable"];
$nestedData[] = $row["review_date"];
$nestedData[] = $row["review_by"];
$nestedData[] = $row[""];
$nestedData[] = $row["closed"];
$nestedData[] = $row["closed_by"];
$nestedData[] = $row["closed_date"];
$data[] = $nestedData;
}
$json_data = array(
"draw" => intval($requestData['draw']),
"recordsTotal" => intval($totalData),
"recordsFiltered" => intval($totalFiltered),
"data" => $data
);
echo json_encode($json_data); // send data as json format
?>
私の質問は、私は、JSONデータストア経由のハイパーリンクを生成することができる午前、または私はJavascriptを利用しなければならないの次のようにJSONデータストアファイルはありますか?どんな指導も大歓迎です。作成JSON前に、配列の変化IDを格納しながら
非常にシンプルに、私はそれを過剰に考えていました!あなたの助けをありがとう –
あなたは歓迎ですS.King –