| Support Center

(Back to Website)

Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

WHERE TO START

Cihat Apr 06, 2013 01:53PM PKT

Hi,

I downloaded phpgrid and installed on localhost to make some tests. At first I changed the language and then I wanted to change column names. After a lot of "look here-look there"s I finally found by chance that they could be done by changing the field names from the database table. But then I wanted to make ID field hidden but couldn't find how to do that. I checked all the titles here and FAQ and documentation. It's told that it can be done simply by adding some strings but I couln't understand what I will change, where I will write.

Or can we say we can't even make some basic changes because it's the free version?

Up 2 rated Down
Abu Ghufran Apr 06, 2013 11:53PM PKT PHP Grid - Support Center Engineer
Check out getting started on http://phpgrid.org/docs


This PHP Grid Control enables functioning of reusable features of CRUD, Search, Sort, Paging etc.
To start with, here is simplest example.

<?php
// we are assuming that database connection are already set

// include and create object
include("inc/jqgrid_dist.php");
$g = new jqgrid();

// set few params
$grid["caption"] = "Sample Grid";
$g->set_options($grid);

// set database table for CRUD operations
$g->table = "clients";

// render grid and get html/js output
$out = $g->render("list1");
?>

`->set_options()` function is most of the customization, we'll be learning.
`->table` is required, to enable automatic select,add,update,delete operation. Behind the scene it'll create the DML queries binded with this table. By default all columns of the table are selected on grid. We'll review how to change it.
`->render()` will generate the final output, to be displayed in view. It takes **Grid ID** as input, which should be unique on a page.

Now we will display the generated grid code `$out` along with few external css/js files. It's upto you to place external css and js files at appropriate locations.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>

<!-- these css and js files are required by php grid -->
<link rel="stylesheet" href="js/themes/redmond/jquery-ui.custom.css"></link>
<link rel="stylesheet" href="js/jqgrid/css/ui.jqgrid.css"></link>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
<!-- these css and js files are required by php grid -->

</head>
<body>
<div style="margin:10px">

<!-- display grid here -->
<?php echo $out?>
<!-- display grid here -->

</div>
</body>
</html>

and to hide ID column,

#### Hiding Column

At instance, we don't want to show column in grid (like primary key), and it is equally needed for background operations like update or delete.
`hidden` property can work here.

// don't show this column in list, but in edit/add mode
$col["hidden"] = true;

Another scenario is we want to hide it on grid list, and display it on Add or Edit forms.

$col["editrules"] = array("edithidden"=>true);
Up -3 rated Down
Cihat Apr 07, 2013 12:18AM PKT
I think I've got to give up because now I'm feeling quite stupid. I've checked all the docs as I told and now I read your reply again and again. I still don't understand where and how to put parametres to change column names, width, hide, etc.
Up 2 rated Down
Abu Ghufran Apr 07, 2013 12:25AM PKT PHP Grid - Support Center Engineer
Please readout the example file in download archive.
It is working demo, and will give you a quick overview.

I understand your concern, it is difficult right now on web.

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)

Contact Us

https://d218iqt4mo6adh.cloudfront.net/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete