Page 1 of 1

Hyperlink on a Column of $db->ExecuteHtml

Posted: Mon Feb 01, 2016 2:40 am
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.


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Mon Feb 01, 2016 11:18 am
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".


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Mon Feb 05, 2018 9:59 pm
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


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Mon Feb 05, 2018 11:16 pm
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.


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Tue Feb 06, 2018 5:36 pm
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.


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Wed Feb 07, 2018 1:24 pm
by arbei

Update your code as below and try again.

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


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Wed Feb 07, 2018 10:58 pm
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


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Thu Feb 08, 2018 10:52 am
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.


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Thu Feb 08, 2018 3:42 pm
by andyrav

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


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Thu Feb 08, 2018 6:17 pm
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.


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Fri Feb 09, 2018 4:58 am
by andyrav

Anyway to achieve this with jQuery?


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Fri Feb 09, 2018 12:39 pm
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.


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Sat Feb 10, 2018 6:06 pm
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.


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Sun Feb 11, 2018 3:53 pm
by andyrav

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

Many thanks


Re: Hyperlink on a Column of $db->ExecuteHtml

Posted: Mon Feb 12, 2018 12:44 pm
by mobhar

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