Column Title-linked-to-mysql-field

QuestionsColumn Title-linked-to-mysql-field
Tony Wolsey asked 4 months ago

Hi Abu

Is there a way to link $col[\”title\”] to a MySQL field/table?

thanks

Tony

6 Answers
Abu Ghufran Staff answered 4 months ago

If you omit setting $col[“title”] in column definition, it will pick database field name automatically after remove _ and making it first letter upper case words. For that i can send you an update. Will it work for your case?

_________________________
Abu Ghufran - Dev Team
PHP Grid Framework
 
Tony Wolsey answered 4 months ago

thanks Abu

I need to link the column title to another separate table and field. A field different than the actual field that represents the column.

 

thanks

Tony

Abu Ghufran Staff answered 4 months ago

Can you explain with some example? whats the business case linked with it.

_________________________
Abu Ghufran - Dev Team
PHP Grid Framework
 
Tony Wolsey answered 4 months ago

I need to allow the user to be able to customize the text of the column title by filling in a field in another table.

thanks

Tony

Abu Ghufran Staff answered 4 months ago

You can assign custom tooltip to any column using:

$col[“tooltip”] = “My Custom Tooltip from other table”;

Now before that, you need to fetch the text to show there from database. For that you can execute query like:

$rs = $g->get_one(“select tooltip, …… where col_name like ‘{$col[“name”]}'”);
And use:

$col[“tooltip”] = $rs[“tooltip”];

Hope it helps.

_________________________
Abu Ghufran - Dev Team
PHP Grid Framework
 
Tony Wolsey answered 3 months ago

Thanks Abu

I did the following and it worked.

$phase1 = $g->execute_query(“select phase1 as ” from tblprojectdetails where projectnumber = ‘$groupselectednew'”);

 

$col[“title”] = “$phase1(%)”;
//$col[“title”] = “IFR (%)”;
$col[“name”] = “phase1”;
$col[“width”] = “75”;
$col[“editable”] = true;
$col[“search”] = true;
$col[“export”] = true;
$col[“align”] = “center”;
$col[“formatter”] = “percentage”;
$col[“editoptions”] = array(“size”=>20, “defaultValue”=>’100.00′);
$cols[] = $col;

thanks

Tony

Your Answer

5 + 2 =

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 / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!