Hiding a particular column of a table from grid

QuestionsHiding a particular column of a table from grid
Bhavesh Garg asked 9 years ago

I have added a new column;ID to my table to select it as a primary key only for developer purpose and I want to hide it when displaying the grid as it is of no use to end-user and will only create confusion. Can you please tell me what changes should I make to the "index.php" file given in phpGrid_Free version in it's demo->editing folder. I have been trying to do it from last 2 days but I can't. Thanks

6 Answers
Abu Ghufran answered 9 years ago

To hide a column, you need to define column settings as mentioned here:
http://www.phpgrid.org/docs/#Selecting_Specific_Columns

And after that, make the ID column as hidden:
http://www.phpgrid.org/docs/#Hiding_Column

Refer demos / misc / example-all for full options demo.

Bhavesh Garg answered 9 years ago

I have tried this but it's not working. I don't know why.
This are the lines which I added in ..demos/editing/index.php

$col = array();
$col["title"] = "GDAid";
$col["name"] = "GDAid";
$col["hidden"] = true;
$col["hidedlg"] = true;
$col["editrules"] = array("edithidden"=>true);
$col["viewable"] = false;
$cols[] = $col;

but no result.

Abu Ghufran answered 9 years ago

Share complete code for review.
You can use pastebin.com

Bhavesh Garg answered 9 years ago

Hi, here is my complete code -> http://pastebin.com/AN3RW7MB

Abu Ghufran answered 9 years ago

On line 40, you should call:

$g->set_columns($cols,true);

Refer documentation for more help

Bhavesh Garg answered 9 years ago

I am using the same code provided by the site in it's package. I had just made minor changes according to my needs

Your Answer

3 + 20 =

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?