Title: datagrid hyperlink event Post by: kvkv on March 13, 2013, 01:04:04 AM Hi I used easyUI datagrid to view the user details. User has 10 attributes. I need to show only 6(columns) attributes in the datagrid. I want to add new column as "View Details". I need to display the 10 user details in another page as user_details.php when I click the viewdetails hyper link at any row. I retrieved data from get_details.php page.
I attached code which I used in the project below //datagrid page <table id="dg" title=" Requests" class="easyui-datagrid" style="width:850px;height:330px" url="/get_details.php" toolbar="#toolbar" pagination="true" rownumbers="true" singleSelect="true"> <thead > <tr> <th field = "name" width = "120">Name</th> <th field = "address" width = "120">Address</th> <th field = "phone" width = "120">Phone</th> <th field = "expected_time_period" width = "120">Expect Time</th> <th field ='' " width = "120">View Details</th> </tr> </thead> </table> //In the datagrid I attached View Details column. But I dont know how give the hyper link event to the column.All the columns get values from get_details.php page except this column. I need to send user Id throw the hyperlink to user_details.php. So please suggestion to the line "<th field ='' " width = "120">View Details</th>" //get_details.php <?php $page = isset($_POST['page']) ? intval($_POST['page']) : 1; $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10; $offset = ($page-1)*$rows; $result = array(); $rs = mysql_query("select count(*) from user where status = 1"); $row = mysql_fetch_row($rs); $result["total"] = $row[0]; $rs = mysql_query("select * from user where status = 1 limit $offset,$rows"); $items = array(); while($row = mysql_fetch_object($rs)){ array_push($items, $row); } $result["rows"] = $items; //print_r($Items); echo json_encode($result); ?> I am new to php coding. I also attached screen shot of the datagrid. Please check it. Thanks & Regards Title: Re: datagrid hyperlink event Post by: stworthy on March 13, 2013, 02:20:34 AM Please use 'formatter' function to define a hyperlink column.
Code: <script> Title: Re: datagrid hyperlink event Post by: kvkv on March 13, 2013, 03:24:47 AM Hi stworthy,
Thank you very much. It works fine. Thanks & Regards |