link colum not showing on grid

Questionslink colum not showing on grid
jiga asked 7 years ago

Hi, im trying to display a virtual link column to do some operations, but column is not showing, i can make dbfields as links but I need a virtual column how can I do that? This is my code:

$col = array();
$col[“title”] = “ID”;
$col[“name”] = “id”;
$col[“width”] = “40”;
$col[“align”] = “center”;
$col[“editable”] = false;
$col[“hidden”] = true;
$cols[] = $col;

$col = array();
$col[“title”] = “<i class=’fas fa-building’></i> GRUPO”;
$col[“name”] = “grupo”;
$col[“width”] = “40”;
$col[“align”] = “center”;
$col[“editable”] = false;
$col[“resizable”] = false;
$cols[] = $col;

$col = array();
$col[“title”] = “<i class=’fas fa-pencil-alt’></i> NOMBRE”;
$col[“name”] = “nombre”;
$col[“width”] = “40”;
$col[“align”] = “center”;
$col[“editable”] = false;
$col[“resizable”] = true;
$cols[] = $col;

$col = array();
$col[“title”] = “<i class=’fas fa-file-alt’></i> CURP”;
$col[“name”] = “curp”;
$col[“width”] = “40”;
$col[“align”] = “center”;
$col[“editable”] = false;
$col[“resizable”] = true;
$cols[] = $col;

$col = array();
$col[“title”] = “Action”;
$col[“name”] = “id”;
$col[“link”] = “clientreg.php?id={id}”;
$col[“linkoptions”] = “target=’_self'”;
$col[“width”] = 25;
$col[“editable”] = false;
$col[“search”] = false;
$cols[] = $col;

$grid[“rowList”] = array(10,20,30,40,50,’All’);
$grid[“autowidth”] = false;
$grid[“sortable”] = true;
$grid[“rowNum”] = 16;
$grid[“rownumbers”] = true;
$grid[“rownumWidth”] = 30;
$grid[“forceFit”] = true;
$grid[“shrinkToFit”] = true;
$grid[“resizable”] = true;
$grid[“autoresize”] = true;
$grid[“multiselect”] = false;
$grid[“altRows”] = true;
$grid[“cellEdit”] = false;
$grid[“reloadedit”] = true;
$grid[“caption”] = “<i class=’fas fa-envelope’></i> CONTROL ESCOLAR – SOLICITUD DE CURP”;
$grid[“loadtext”] = “<i class=’fa fa-spinner fa-2x fa-spin’></i> Buscando coindicencias …”;
$grid[“sortname”] = ‘grupo’; //TEN CUIDADO CON ESTOS TE PUEDEN CAUSAR PROBLEMAS EN LAS CONSULTAS
$grid[“sortorder”] = “desc”;
$grid[“add_options”][“jqModal”] = true;
$grid[“add_options”][“modal”] = true;
$grid[“edit_options”][“jqModal”] = true;
$grid[“edit_options”][“modal”] = true;
$grid[“edit_options”][“checkOnSubmit”] = true;
$grid[“add_options”][“success_msg”] = “<i class=’fa fa-check’></i> Registro agregado exitosamente”;
$grid[“edit_options”][“success_msg”] = “<i class=’fa fa-check’></i> Registro modificado exitosamente”;
$grid[“delete_options”][“success_msg”] = “<i class=’fa fa-check’></i> Registro eliminado exitosamente”;

$g->set_actions(array(“add”=>false,”edit”=>false,”delete”=>false,”view”=>false,));
$g->set_options($grid);
$g->select_command = “SELECT id,grupo,nombre,curp FROM buho3448_econ.alumnos”.$ciclo_anos;
$g->table = “buho3448_econ.alumnos”.$ciclo_anos;
$g->set_columns($cols,true);
$out = $g->render(“list1”);
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”&gt;
<html>
<head>
<script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script&gt;
<link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css&#8221; integrity=”sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm” crossorigin=”anonymous”>
<script src=”https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js&#8221; integrity=”sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl” crossorigin=”anonymous”></script>
<script src=”https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js&#8221; integrity=”sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q” crossorigin=”anonymous”></script>
<script defer src=”https://use.fontawesome.com/releases/v5.0.8/js/all.js&#8221; integrity=”sha384-SlE991lGASHoBfWbelyBPLsUlwY1GwNDJo3jSJO04KZ33K2bwfV9YBauFfnzvynJ” crossorigin=”anonymous”></script>
<link href=”css/escuela.css” media=”screen” rel=”stylesheet” type=”text/css” /> 
<link rel=”stylesheet” type=”text/css” media=”screen” href=”lib/js/themes/dot-luv/jquery-ui.custom.css”></link> 
<link rel=”stylesheet” type=”text/css” media=”screen” href=”lib/js/jqgrid/css/ui.jqgrid.css”></link>    
 
    <script src=”lib/js/jquery.min.js” type=”text/javascript”></script>
    <script src=”lib/js/jqgrid/js/i18n/grid.locale-en.js” type=”text/javascript”></script>
    <script src=”lib/js/jqgrid/js/jquery.jqGrid.min.js” type=”text/javascript”></script>    
    <script src=”lib/js/themes/jquery-ui.custom.min.js” type=”text/javascript”></script>
</head>

1 Answers
Abu Ghufran Staff answered 7 years ago

Hi,
It looks like you are using older version of library.
You can try adding all columns manually are remove the second param ‘true’ from set_column.
$g->set_columns($cols,true); >>> $g->set_columns($cols);

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
jiga replied 7 years ago

But if I do that:
If you want to customize any specific column properties, and let other columns be displayed from table definition, you can pass 2nd argument of set_columns($cols,true) to true.
$col = array();
$col[“name”] = “company”;
$col[“edittype”] = “textarea”;
$cols[] = $col;

$g->set_columns($cols,true);
Only column with name ‘company’ will be changed to textarea and rest table column will be displayed as they were before.

NOTE: The first column must have unique data (usually PK) in order to work properly. It is required to identify and perform row wise operations. You can make it hidden in grid if you wish. See hidden property in later section for more.

would this be a problem?

Your Answer

20 + 14 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?