Page 1 of 1

Customizing the Data Displayed in the Table View

Posted: 2020-07-14 03:58
by jrcervantest
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;
       }

Re: Customizing the Data Displayed in the Table View

Posted: 2020-07-14 06:04
by jsetzer
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>

Re: Customizing the Data Displayed in the Table View

Posted: 2020-07-14 12:56
by jrcervantest
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,

Re: Customizing the Data Displayed in the Table View

Posted: 2020-07-14 13:08
by jsetzer
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.

Re: Customizing the Data Displayed in the Table View

Posted: 2020-07-14 14:09
by jrcervantest
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 =…

Re: Customizing the Data Displayed in the Table View

Posted: 2020-07-17 22:42
by jrcervantest
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,

Re: Customizing the Data Displayed in the Table View

Posted: 2020-07-17 23:36
by jsetzer
Great, I'm glad it works now!
Regards,
Jan