1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

[SOLVED] Custom_css and calc element

Discussion in 'Community' started by maxinic, Apr 21, 2021.

  1. maxinic

    maxinic Member

    Level: Community
    Hy everyone
    I have a simple calc element (use as a row class):

    $abrogata = ('{ordinarie___abrogata}');
    if ($abrogata = 1)
    { return 'colrosso'; };

    Where ('{ordinarie___abrogata}') is a yes/no element.

    This is my custom_css.php
    #listform_$c {
    margin-top: 25px !important;
    }
    #listform_$c tr.colred td.ripiegamenti___data_ripiegamento {color:red;};
    #listform_$c tr.ordinarie.colrosso td.ordinarie__TITOLO {color:red;};

    Unfortunately nothing change on my rows. Any tips for me?


     
  2. juuser

    juuser Well-Known Member

    Level: Community
    Try:

    $abrogata = '{ordinarie___abrogata_raw}';
    if ($abrogata == 1)
    { return 'colrosso'; }

    And also remove semicolons after the closing brackets in custom_css.php, that means } instead of };

    And make sure with browser inspect function that the class which "mark as row class" function adds, is the one that you have in custom_css.php
     
    troester likes this.
  3. maxinic

    maxinic Member

    Level: Community
    Thanks for the reply juuser but i think that the problem is in Custom_css.php because calc element works well
    upload_2021-4-22_9-50-19.png
    could it be that by returning a number (1) I have to add something?
     
  4. juuser

    juuser Well-Known Member

    Level: Community
    You have to check the right class name with browser inspect function. For the element called "myelement", added class is something like "myelement_1" when elements value is "1".
     
  5. maxinic

    maxinic Member

    Level: Community
    in fact the custom_css is not applied
    how can you see:

    upload_2021-4-22_10-42-36.png

    however my class name should be colrosso not a number
    I'm confused :)
     
  6. troester

    troester Well-Known Member Staff Member

    Level: Community
    "Use as row class" is adding the class to the <tr tag, check if it's there.
     
  7. maxinic

    maxinic Member

    Level: Community
    #listform_$c tr.colrosso td.ordinarie__TITOLO {color:red}
    :(
     
  8. troester

    troester Well-Known Member Staff Member

    Level: Community
    Check in your browser console if the class is added to the tr (not td), if your CSS "source" is loaded correctly etc.
     
  9. maxinic

    maxinic Member

    Level: Community
    This is from my browser

    upload_2021-4-22_11-51-15.png
     

    Attached Files:

  10. troester

    troester Well-Known Member Staff Member

    Level: Community
    So colrosso is correctly added.

    Check in the browser if your custom_css.php is loaded correctly (you may have a typo breaking the CSS...), you should get something like this
    upload_2021-4-22_12-35-14.png
     
  11. maxinic

    maxinic Member

    Level: Community
    I don't know why but, I just copied and pasted a brace and the text turned red. Thanks to everyone anyway
     
  12. troester

    troester Well-Known Member Staff Member

    Level: Community
    I just found that it seems you have/had a missing _ in your CSS
    #listform_$c tr.ordinarie.colrosso td.ordinarie__TITOLO {color:red;}; it must be 3_
    #listform_$c tr.ordinarie.colrosso td.ordinarie___TITOLO
     
  13. maxinic

    maxinic Member

    Level: Community
    thanks I had noticed
     

Share This Page