Customizing the Data Displayed in the Table View

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
jrcervantest
Veteran Member
Posts: 32
Joined: 2020-06-22 00:00

Customizing the Data Displayed in the Table View

Post by jrcervantest » 2020-07-14 03:58

As some of you are aware, there is a step by step on how to customize the data displayed in the table view. (https://bigprof.com/appgini/tips-and-tu ... eview-data) This is a great feature to employ except, I'm having a difficult time developing the most important line of all; the parameters for the SQL formatting. Respectfully request some assistance for anyone who is familiar with this syntax. V/r,

My table Name: Links
My Field: "Lvl' (integer)

Code: Select all

      function links_init(&$options, $memberInfo, &$args){
      $oldFields = $options->QueryFieldsTV;
      foreach($oldFields as $field => $title){
      if($field == '`links`.`lvl`'){
            
   // [b]this is where I get stuck[/b]
      $modField = "CONCAT('<img src=https://xxxxxx/links/hooks/1.png"\"hooks/',`links`.`lvl`,'.png\"" border="\"0\"">')"
      
      $newFields[$modField] = $title;
               }else{
      $newFields[$field] = $title;
        }
       }
      $options->QueryFieldsTV = $newFields;
      return TRUE;
       }

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Customizing the Data Displayed in the Table View

Post by jsetzer » 2020-07-14 06:04

Hopefully this will work:

Code: Select all

$modField = "CONCAT('<img src=\"https://xxxxxx/links/hooks/', `links`.`lvl`, '.png\" border=\"0\">')";
By the way: I recommend adding a class-attribute instead of border-attribute and doing all styling in CSS:

Code: Select all

$modField = "CONCAT('<img src=\"https://xxxxxx/links/hooks/', `links`.`lvl`, '.png\" class=\"img-level\">')";

Code: Select all

<style>
img.img-level {
  /* your styling here /*
}
</style>
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

jrcervantest
Veteran Member
Posts: 32
Joined: 2020-06-22 00:00

Re: Customizing the Data Displayed in the Table View

Post by jrcervantest » 2020-07-14 12:56

Jan,

No success. The $modfField is not concatenating.
I've tried the following,

changing the various data type formats for the receiving field [lvl]
using .png, .gif, etc.
selecting other fields in lieu of [lvl]
even tried hugging my computer

but still nothing Sir. :oops:

Does the receiving field (in my case [lvl]) have to be a certain data type?

V/r,

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Customizing the Data Displayed in the Table View

Post by jsetzer » 2020-07-14 13:08

jrcervantest wrote:
2020-07-14 12:56
No success. The $modfField is not concatenating.
What is the result?
  • An error in PHP?
  • An error in SQL?
  • The original value?
  • An image not being displayed?
  • Are you sure about

    Code: Select all

    $field == '`links`.`lvl`'
Does the receiving field have to be a certain data type?
numeric and varchar types should work. Blob may not work and I guess text-types should be converted into varchar before. But you should get an SQL error if this was the problem.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

jrcervantest
Veteran Member
Posts: 32
Joined: 2020-06-22 00:00

Re: Customizing the Data Displayed in the Table View

Post by jrcervantest » 2020-07-14 14:09

The result is no effect in normal screen. No error in PHP, SQL etc.. I’m not getting an error displayed anywhere nor any change in the TV appearance. (see pic 1&2) I also rechecked the $field == '`links`.`lvl`' it looks correct. (I actually changed the field name “lvl” to “lvls” since, originally, it was a look up field and the parent table was also called “lvl” as well. I thought that could have been interfering.)

I also just noticed that when I minimize my screen, the syntax from the links.php appears right above the TV. (see pic 3)

As indicated previously,

My table name: links
Field name now: “lvls”
Pic files: hooks/1.png, 2.png, 3.png
Parameters stored in: links.php, as indicated above with the exception of the following update,

$modField = "CONCAT('<img src=\"https://xxxxxx/links/hooks/', `links`.`lvls`, '.png\" border=\"0\">')";

Using borders for now till I get it working before implementing class =…
Attachments
2.png
Pic 3
2.png (242.05 KiB) Viewed 2379 times
1.png
Pic 1 & 2
1.png (109.32 KiB) Viewed 2379 times

jrcervantest
Veteran Member
Posts: 32
Joined: 2020-06-22 00:00

Re: Customizing the Data Displayed in the Table View

Post by jrcervantest » 2020-07-17 22:42

Jan,

It WORKED! It worked!! Thank you so very much Sir! Your recommendations above were absolutely correct.
It was definitely operator error. I think I may have been fixated on the table-dv.js and completely overlooked the existing "function links_init in the links.php file. Jut had to come back to it after a while with a fresh look. Thank you again for your assistance. I truly appreciate it.

V/r,

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Customizing the Data Displayed in the Table View

Post by jsetzer » 2020-07-17 23:36

Great, I'm glad it works now!
Regards,
Jan
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

Post Reply