Forums

style row to condition

mlosito 29 Nov, 2016
God Morning everybody,
my name is Mauro and i'm new members.
For my company i have going to create a system for production schedule.
Now I have little problem.
in my CCV5 there is a conditions in the model->conditions and it'is OK, i have in modules-->fields a function sum(qta) and it's ok.
I want color the rows of the table where this sum(qta) is >40.
You can Help me?

Thanks
GreyHead 29 Nov, 2016
Hi Mauro,

If you use the Display Type > Custom for your listing then you can add code to the List Display > Body Code ox to check the value of the sum and set a class for the <tr> element that you can then color with CSS.

Bob
mlosito 29 Nov, 2016
hallo GreyHead, thanks for your quick response.
I've tried to write a php code in
front list -> list display -> custom -> body code but i think that I did not understand how it works as.

i tried write for example
<?php echo('pippo') ?> but I do not go blank.

excuse my ignorance, but could not find specifics on what to write in this field...
GreyHead 29 Nov, 2016
Hi miosito,

Have you set the Display Type to Custom on the Front List > Settings tab?

Bob
mlosito 29 Nov, 2016
hi Bob,
i'm very stupid...i have not chage value custom in setting tab...
ok..now custom work...but i must rewrite all the code to create all the table?
GreyHead 29 Nov, 2016
Answer
Hi mlosito,

If you want to use that method - then yes. It might be possible to use JavaScript to check the values and apply the styling using the Table layout if that is simpler. I've never tried that but I think it should work.

Bob
mlosito 29 Nov, 2016
ok Bob,
last questions
if i want use javascript where i must write the code? I must use a particolar type of code?
Max_admin 29 Nov, 2016
2 Likes
Hi Mauro,

Under "Front list" > "List display" > "Table" "header code", there is a box where you can add javascript code with tags.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
mlosito 29 Nov, 2016
Thank's....everybody!
mlosito 29 Nov, 2016
.....ops..
i tried bat it is not simple...i think that is not possible use only javascript function in the header because i must change color of row only if a determinate field in the row il >40 for example.
you have idea?

another questions..
how to use "PHP function" and "HTML" in the front list setting? they can resolve the problem?

Thanks.... I think that I buy the manual when it becomes available
Max_admin 30 Nov, 2016
1 Likes
Hi Mauro,

You can use the value in the class attribute and use that as a selector for even css, if you have a custom list then in the body box:

<li class="value_{valuefield}">some data here</li>


And you can then use css:

li.value_40{color:red;}


You use php functions and other features as normal, they help if you have "Table" listing, but in custom listing you can do anything.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 08 Dec, 2016
Hi Mauro,

I experimented with this and was able to do something similar using JavaScript in the Header box.
<?php
$jdoc = \JFactory::getDocument();
$script = "
jQuery(document).ready(function(jQ){
  jQ('td[class$=id]').each( function() {
    var id = jQ(this).html();
    if (parseInt(id) > 3 ) {
      jQ(this).css('border', '1px solid blue');
    }
  })
});
";
$jdoc->addScriptDeclaration($script);
?>
The code here checks for <td> elements with classes ending in id (CC adds classes like td-content.id that you can use) and, if the entry in the <td>. element is greater than 3 it adds a blue border to the cell.

I think that this can be adapted to do what you need.
Bob
mlosito 09 Jan, 2017
Thank very much...it.'s work very well
This topic is locked and no more replies can be posted.