CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

[HowTo] Set the row style/css

by Alexander Bulei » 17 Dec 2014 11:45

  • Set the row style/css (all rows)

    Use the RowAttr property :

    • For style
      delphi code
      FGrid.JQGridOptions.RowAttr:= '{ "style" : "color: orange;" }

    • For css class
      delphi code
      FGrid.JQGridOptions.RowAttr:= '{ "class" : "mycss-class" }
  • Set the row style/css based on cell value

    Use the RowAttrFn property:

    delphi code
    JScript:= TIWCGJScript.Create;
    try
    with JScript do
    begin
    Add('function(ts, td, curr, id){');
    Add(' if (ts.Kind == "0") {');
    Add(' return { "style" : "color: red"}');
    Add(' } else {');
    Add(' return { "style" : "color: green"}');
    Add(' }');
    Add('}')
    end;
    Result.JQGridOptions.RowAttrFn.Script:= JScript.Text;
    finally
    JScript.Free;
    end;


    In the example above, we will check the value of the column "Kind", and based on the value change the text color.

    Check documentation for more information.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

Return to JQGrid

cron

Who is online

Users browsing this forum: No registered users and 2 guests

Contact Us.