WHERE TO START

QuestionsWHERE TO START
Cihat asked 8 years ago

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?

4 Answers
Abu Ghufran answered 8 years ago

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"&gt;
<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);

Cihat answered 8 years ago

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.

Abu Ghufran answered 8 years ago

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.

cobalt answered 6 years ago

I think it's better you prepare us some instructive videos of how to run the script successfully.

Your Answer

10 + 5 =

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?