Setting Colour on font depending on their status!

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1814
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Setting Colour on font depending on their status!

Post by jsetzer » 2022-03-09 11:20

It seems you weren't able to attach those files but only paste content. Anyway, if there is nothing more and if both files are in place and if your tablename equals TEST I don't see any further mistakes. Should work like this and works here as expected.

(1) Stupid question
After fixing your bug with those additional brackets, did you reload the page without caching?
Does the error "Uncaught ReferenceError: AppGiniTableViewBackgroundChanger" still occur after reloading the page in the browser without cache?

(2) Another question
If javascript cannot find the function named AppGiniTableViewBackgroundChanger and if there is no other error messsage, maybe your code in header-extras.php was not included. So, are you sure both file are in hooks-subdirectory:
  • hooks/header-extras.php
  • hooks/TEST-tv.js
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

espo
Veteran Member
Posts: 98
Joined: 2013-03-01 12:55

Re: Setting Colour on font depending on their status!

Post by espo » 2022-03-09 13:10

Hello,
I answer you questions:

This is my host with the two files uploaded to the HOOKS folder
Image

This is the one inside the php and js file
Image

Image

I don't know what else to do.
Could it be hosting that doesn't allow something?

I cleared the cache and tried using explorer and edge as well.
It doesn't work with these browsers either.

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

Re: Setting Colour on font depending on their status!

Post by jsetzer » 2022-03-09 16:14

And does the error still occur?
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

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

Re: Setting Colour on font depending on their status!

Post by jsetzer » 2022-03-09 16:40

Just a simple test:

hooks/header-extras.php

Code: Select all

<script>
alert("script in header-extras");

function test_alert() {
  alert("hello world");
}
</script>
hooks/TEST-tv.js

Code: Select all

jQuery(document).ready(function(){
  test_alert();
});

alert("script in tv file");
After reloading TEST table (in table view of course) (URL: YOURSERVER/AND/PATH/TEST_view.php) there should be...
  1. a first alert showing "script in header-extras"
  2. a second alert showing "script in tv file"
  3. a third alert showing "hello world".


If this does not work, there must be something wrong with your setup, I'm afraid.
  • Does this work?
  • Are there any error messages, for example another Uncaught ReferenceError: test_alert. Please post them.
  • Ensure you are overwriting the files on FTP upload
  • Ensure you are testing with your browser against the same URL which matches the directory of your FTP upload
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

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Setting Colour on font depending on their status!

Post by peebee » 2022-03-09 23:07

Hi Jan, I just gave your color change script a run (in hooks/header-extras.php and hooks/tablename-tv.js as prescribed) and experienced exactly the problem.

Uncaught ReferenceError: AppGiniTableViewBackgroundChanger

Moved the script order around in header-extras.php and also tried the same script in footer-extras.php Same result.

Took your (unedited) script from header-extras.php and placed it in the relevant hooks/tablename-tv.js directly above your AppGiniTableViewBackgroundChanger function and bingo - color change works correctly!

How to rectify, so your script will work in header-extras.php on all tables I'm not sure? I'll leave that to you. :)

espo
Veteran Member
Posts: 98
Joined: 2013-03-01 12:55

Re: Setting Colour on font depending on their status!

Post by espo » 2022-03-11 15:49

Hi Peebee,
you put the code in header-extras.php in xxx-tv.js
Without modifying it or did you remove <script>?

I've tried too but it still doesn't work.

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

Re: Setting Colour on font depending on their status!

Post by jsetzer » 2022-03-11 19:13

Thanks for your feedback. Gonna test it again next week.

Should be fine to put function into header-extras (<script>...</script >) and function call into TABLENAME-tv.js (directly, no script-tags around).

Maybe it's a timing problem? Gonna check it. Stay tuned.
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