dbr.report - formatting after event=click

(2 posts) (2 voices)
  • Started 3 years ago by ajdjackson
  • Latest reply from myDBR Team
  1. ajdjackson, Member


    I've a pretty simple linked report that allows the user to click on a Yes/No field.

    What I can't work out is how to format the field after it has been clicked. In my example below if the field value is Yes then the font colour is Green. If the user clicks this field and sets it to No then I would like it to be red.



    This is my code:
    select 'dbr.report', 'sp_DBR_plot_sunroom_edit','[sunroom]','hiddendiv', 'inPL_ID=ID','event=click'; select 'dbr.embed_object', 'hiddendiv'; select 'dbr.hideheader'; select 'dbr.hidecolumn',1;

    select 'dbr.css', '.redclass {color:red;} .greenclass {color:green;}'; select 'dbr.cellclass', 'sunroom', 'class'; select 'dbr.hidecolumns', 'class';

    select 'dbr.divify','garage';

    select t.tblContractXidJobNo as 'PlotID[ID]', t.Plot_SunRoom as 'SunRoom[sunroom]', if (t.Plot_SunRoom = "No",'redclass','greenclass') as 'class'

    from hilmark.tblsitesplotsjake t

    where t.tblContractXidJobNo ="MEWS_05";

    Posted 3 years ago #
  2. myDBR Team, Key Master

    the event=click set the mydbr_selected_cell to point to the cell in question. You can set both the content ('Yes' / 'No') and the classname for the cell by using jQuery:

    select 'dbr.javascript', concat("$(mydbr_selected_cell).text('", v_result ,"').toggleClass('greenclass redclass');");

    The v_result will contain either the 'Yes' or 'No'. When giving multiple classnames to toggleClass, it toggles between them.
    myDBR Team

    Posted 3 years ago #


You must log in to post.