This topic is locked

when Details <0 change cell-color

12/11/2007 11:57:29 AM
PHPRunner General questions
scuba author

I'm trying to display a "masterkey" cell (i.e. "orders") in a different color when details are found. Simplified that would be something like:
if "Details found" != 0 then "orders-cell" = red (embarassing, isn't it <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=7044&image=1&table=forumtopics' class='bbc_emoticon' alt=';)' /> )
Anyway, can anybody suggest some code for doing that - and is there a way to do it inside of phprunner without editing *_list.php, would be more convenient
thanks

J
Jane 12/12/2007

Hi,
try to use List page: After record processed event for this purpose.

Here is a sample code:

global $conn;

print_r($row);

$str = "select * from DetailTable where DetailID=".$data["MasterID"];

$rs = db_query($str,$conn);

if (!$data = db_fetch_array($rs))

{

//change style if there are no records in the detail table for this MasterID

$row["shadeclass"] = "class=\"yournewclass\"";

$row["shadeclassname"] = "yournewclass";

}


Declare yournewclass in the include/style.css file.

scuba author 12/12/2007

Jane, thanks for helping.

As you can see on the screenshot I have a major problem here! I get all that data printed at the top of the page.

Also, what I meant was only coloring the TNR- or OFF-field if there are details found - not the entire row. Since I guess this refers to html I'm not sure where to find the definitions for those fields. I've checked *_list.php and it's pure php. Can't find any defined variables for the TNR/OFF fields. What can I do?
best regards

J
Jane 12/13/2007

Hi,
sorry for my fault.

You need to remove print_r($row); in the code. This line is for debugging purpose.
To apply red color to detail link only you need to do the following:

  • find this code on the Visual Editor tab --> HTML mode:
    <TD vAlign=middle align=middle><A class=tablelinks2 id=master_DetailTable_add href="DetailTable_list.php?" {if $useAJAX}

    ...

    {/if}>DetailTable</A></TD>

and replace it with this one:

<TD vAlign=middle align=middle><A {if $row.1detailsfound_value}class=tablelinks2{else}class=newclass{/if} id=master_DetailTable_add href="DetailTable_list.php?" {if $useAJAX}

...

{/if}>DetailTable</A></TD>


  • edit you event code in the List page: After record processed event:
    global $conn;

    $str = "select * from DetailTable where DetailID=".$data["MasterID"];

    $rs = db_query($str,$conn);



    if ($data = db_fetch_array($rs))

    $row["1detailsfound_value"]=true;

    else

    $row["1detailsfound_value"]=false;

scuba author 12/13/2007

Thanks Jane, works great!!

I've played around with the code so that IF details ARE found the field is colored. By the way, I think this would be a great help in general, maybe you guys wanna think about implementing this visual indicator to an upcoming version.
greets

scuba author 12/14/2007

Jane,

I have to bother you again with this issue. Your code works well, but unfortunately I'm unable to make this work for 2 Details-Links (TNR and OFF > see pic above). Here is how I tried to combine:
[codebox]global $conn;

$str = "select id from ges_tnr where id=".$data["id"];

$str = "select id from ges_offer where id=".$data["id"];

$rs = db_query($str,$conn);

if ($data = db_fetch_array($rs))

$row["1detailsfound_value"]=true;

$row["2detailsfound_value"]=true;

else

$row["1detailsfound_value"]=false;

$row["2detailsfound_value"]=false;[/codebox]
can you give me another hint on that? thanks in advance!

Alexey admin 12/14/2007

Hi,
you can get further assistance with this contacting support team directly.
Publish your project on Demo Account and send a URL to it along with the problem description to support@xlinesoft.com

scuba author 12/18/2007

I've uploaded the project to demo account.

J
Jane 12/18/2007

answered in your personal email.