Hyperlink on a Column of $db->ExecuteHtml

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Bishu
User
Posts: 427

Hyperlink on a Column of $db->ExecuteHtml

Post by Bishu »

I am using a Custom File and to get display the record i use the following code.

echo $db->ExecuteHtml($sql1, array("fieldcaption" => TRUE, "tablename" => array("products", "categories")));

It show the query results as table. and I would like to make some changes in the results as follows.
1) How can I make the table header look like the project table header.
2) In one column I would like to make HYPERLINK
eg. In the display table I have a column name "id"
and i would like to make this column a hyperlink.


arbei
User
Posts: 9281

Post by arbei »

You need to pass your CSS classes for the table as "tableclass" in the options array (the 2nd argument of the method "ExecuteHtml"), refer to the code in the method "ExecuteHtml" of "ewdbhelper12.php".


andyrav
User
Posts: 635

Post by andyrav »

Hi
did you manage to get this working? is so are you able to post you css classe for example please.
i basicly was to do the same click on the id field which then opens that record in edit mode if possible


sangnandar
User
Posts: 980

Post by sangnandar »

Have a look on any pages, browser press F12, look for <table class="..." >.
Copy the classname and put into this:
echo $db->ExecuteHtml($sql1, array("fieldcaption" => TRUE, "tablename" => array("products", "categories"), "tableclass" => "<paste here>"));

Give it a try and see how it goes.


andyrav
User
Posts: 635

Post by andyrav »

Thanks, but could not get that to work
tried
echo $db->ExecuteHtml($sql, array("fieldcaption" => TRUE, "tablename" => array("xxxxxxx"), "tableclass" => "ewTableRow ewTableSelectRow"));
echo $db->ExecuteHtml($sql, array("fieldcaption" => TRUE, "tablename" => array("xxxxxxx"), "tableclass" => "table ewTable"));
but none able me to edit the row.

can anyone please help?

many thanks in advance.


arbei
User
Posts: 9281

Post by arbei »

Update your code as below and try again.

echo $db->ExecuteHtml($sql, ["fieldcaption" => TRUE, "tablename" => ["products", "categories"], "tableclass" => "table ewTable"]);


andyrav
User
Posts: 635

Post by andyrav »

Hi
using
echo $db->ExecuteHtml($sql, array("fieldcaption" => TRUE, "tablename" => array("pdorders"), "tableclass" => "table ewTable"));
didnt aloue me to edit the record it just changed the table lay out a bit.
pdorders is my table name.

any ideas?
many thanks


mobhar
User
Posts: 11660

Post by mobhar »

andyrav wrote:
didnt aloue me to edit the record

There is no CRUD feature when you are using ExecuteHtml method to display the data. That method is only for displaying data whether horizontal or vertical layout.


andyrav
User
Posts: 635

Post by andyrav »

It's there any other way to achieve me to click on the row to edit it?


mobhar
User
Posts: 11660

Post by mobhar »

Currently it is not supported. That function was created to display data as read-only. If you want to add the functionality for adding the link to redirect to the edit page, then you need to customize the function in the generated ewdbhelper*.php file.


andyrav
User
Posts: 635

Post by andyrav »

Anyway to achieve this with jQuery?


sangnandar
User
Posts: 980

Post by sangnandar »

If you want CRUD you better go with normal table. Then layout templates and another cool stuffs thing using Custom Template and jQuery. It's a lot easier this way than creating your own CRUD functionality.


mobhar
User
Posts: 11660

Post by mobhar »

andyrav wrote:
Anyway to achieve this with jQuery?

Just inspect the element id/class, and use jQuery .html() to change its HTML code and add the link inside the html code that suits your needs.


andyrav
User
Posts: 635

Post by andyrav »

I am no coder. Can anyone body and example code.

Many thanks


mobhar
User
Posts: 11660

Post by mobhar »

Even you're not a coder, you should always try it by yourself first. Then, post your code for more discussion.


Post Reply