Calculated Footer with defined Columns not working

QuestionsCalculated Footer with defined Columns not working
Gerd asked 3 years ago

Hallo

http://pastebin.com/L19sLPRX

i have the problem with calculated footer and defineing columns for the grid.

The example works, when i comment the following line for the columns

$g->set_columns($cols);

but i want to show not all columns

What ist my problem ?

Greetings
Gerd

4 Answers
Gerd answered 3 years ago

Hallo,

i what to explain my problem a little bit.

When i define Columns for the grid the footer don't work:
Here my Code

$col = array();
$col["title"] = "id_hhc_auftritt_titel"; // caption of column, can use HTML tags too
$col["name"] = "id_hhc_auftritt_titel"; // grid column name, same as db field or alias from sql
#$col["width"] = "10"; // width on grid
$col["editable"] = false;
$col["hidden"] = true;
$col["export"] = false; // this column will not be exported
$cols[] = $col;

$col = array();
$col["title"] = "dt_sekunden"; // caption of column, can use HTML tags too
$col["name"] = "dt_sekunden"; // grid column name, same as db field or alias from sql
#$col["width"] = "10"; // width on grid
$col["editable"] = false;
$col["hidden"] = true;
$col["export"] = false; // this column will not be exported
$cols[] = $col;

$col = array();
$col["title"] = "id_titel"; // caption of column, can use HTML tags too
$col["name"] = "id_titel"; // grid column name, same as db field or alias from sql
#$col["width"] = "10"; // width on grid
$col["editable"] = false;
$col["hidden"] = true;
$col["export"] = false; // this column will not be exported
$cols[] = $col;

$col = array();
$col["title"] = "Titel"; // caption of column, can use HTML tags too
$col["name"] = "dt_titel_bez"; // grid column name, same as db field or alias from sql
$col["width"] = "130"; // width on grid
$col["editable"] = false;
$col["sortable"] = true;
if ( $_SERVER['REMOTE_ADDR'] == "0:0:0:0:0:0:0:1" )
$col["link"] = "http://localhost:8080/_HHCPHP/admin_php/E02_Auftritt_Titel.php?id_hhc_auftritt_titel={id_hhc_auftritt_titel}&ID_HHCBilder01_Abteilung=".$_GET["ID_HHCBilder01_Abteilung"]."";
else
$col["link"] = "http://hhc-freudental.de/_HHCPHP/admin_php/E02_Auftritt_Titel.php?id_hhc_auftritt_titel={id_hhc_auftritt_titel}&ID_HHCBilder01_Abteilung=".$_GET["ID_HHCBilder01_Abteilung"]."";

# $col["linkoptions"] = "target='_blank'"; // extra params with <a> tag
$cols[] = $col;

$col = array();
$col["title"] = "Dauer"; // caption of column, can use HTML tags too
$col["name"] = "dt_titel_dauer"; // grid column name, same as db field or alias from sql
$col["width"] = "50"; // width on grid
$col["editable"] = false;
$col["search"] = false;
if ( $_SERVER['REMOTE_ADDR'] == "0:0:0:0:0:0:0:1" )
$col["link"] = "http://localhost:8080/_HHCPHP/viewhhcNotenJahrgangGraph.php?pn_nr={id_titel}";
else
$col["link"] = "http://hhc-freudental.de/_HHCPHP/viewhhcNotenJahrgangGraph.php?pn_nr={id_titel}";
$cols[] = $col;

$col = array();
$col["title"] = "Komponist"; // caption of column, can use HTML tags too
$col["name"] = "komponist_name_concat"; // grid column name, same as db field or alias from sql
$col["width"] = "100"; // width on grid
$col["editable"] = false;
$cols[] = $col;

$col = array();
$col["title"] = "Bearbeiter"; // caption of column, can use HTML tags too
$col["name"] = "bearbeiter_name_concat"; // grid column name, same as db field or alias from sql
$col["width"] = "100"; // width on grid
$col["editable"] = false;
$cols[] = $col;

$col = array();
$col["title"] = "Verlag"; // caption of column, can use HTML tags too
$col["name"] = "dt_verlag_name"; // grid column name, same as db field or alias from sql
$col["width"] = "110"; // width on grid
$col["editable"] = false;
$cols[] = $col;

$col = array();
$col["title"] = "Sortierung"; // caption of column, can use HTML tags too
$col["name"] = "dt_sort"; // grid column name, same as db field or alias from sql
$col["width"] = "110"; // width on grid
$col["editable"] = true;
$col["search"] = false;
$cols[] = $col;

// pass the cooked columns to grid
$g->set_columns($cols);

When i comment the last statement the footer works.

I hope this help. Please answer me, thanks.

gerd

Abu Ghufran answered 3 years ago

Hi,

The url of pastebin is not opening here due to our ISP.
Try commenting each column which one is causing issue.
Also make sure you are assigning footer detail to a column that is defined in above $cols array.

If it does not help, you can email me at [email protected] (code+db) i can recheck.

Gerd answered 3 years ago

Hallo Abu,

thank you, i have send you an email.

Gerd

Abu Ghufran answered 3 years ago

Resolved on email, pasting for reference.

….

In select_command, you need to alias … , dt_titel_dauer, dt_titel_dauer as dauer_link, …
You can have 2 columns for duration. one with link, one plain text.

Next set dt_titel_dauer as hidden=true.
And in footer function, set the footer value calculation with dt_titel_dauer and show with column dauer_link.

This way, calculation of max/sum will be done with plain text column and shown in link.
Hope it make sense.

Your Answer

2 + 16 =

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!