Hi,
First of all, let me thank you for this wonderful php grid.
I have a question that I hope I'll get an answer to.
How can I have a link in a column with a custom text to display?
I'm having the following code:
$col["title"] = “View more”; // caption of column
$col["name"] = “id”; // grid column name, same as db field or alias from sql
$col["link"] = “http://localhost:8080/openpim/trunk/resources/view.php?document_type=rfi&document_id={id}”;
but the result of this is a hyper-link (which is directed to right path) but the text is an integer ( the ID). How can I change this text to something more user friendly, a custom text like “view details”?
Capture the URL ID in the new page and by using the GET method and use SQL query to obtain details from the ID related in database,u can get easily what u want to display further.
Make 2 columns,
$col["name"] = "id";
$col["hidden"] = true;
…
and other
$col["title"] = “View more”; // caption of column
$col["name"] = “view_more”; // grid column name, same as db field or alias from sql
$col["link"] = “http://localhost:8080/openpim/trunk/resources/view.php?document_type=rfi&document_id={id}”;
And in select_command query, make sql like ..
select f1,f2,f3, "View Details" as view_more FROM table …"
I managed to achieve this using the following:
$col["title"] = "View Details";
$col["name"] = "id";
$col["default"] = "<a href='http://localhost:8080/openpim/trunk/resources/view.php?document_type=rfi&document_id={id}'>View Details</a>";
$cols[] = $col;
The reason that I did this is because I don't want the column Id to be displayed for the users.
if I use:
$col["name"] = "id";
$col["hidden"] = true;
then the user still can make the column visible using the customize (column) button in the toolbar of the grid.