$f["op"] = "cn"; $f["value"] = "01"; $f["css"] = "'background-color':'lightgreen'"; $f_conditions[] = $f; $f = array(); $f["column"] = "id"; $f["op"] = ">"; $f["value"] = "20"; $f["css"] = "'background-color':'pink'"; $f_conditions[] = $f; // if nothing set in 'op' and 'value', it will set column formatting for all cell $f = array(); $f["column"] = "invdate"; $f["css"] = "'background-color':'#FBEC88', 'border-color': 'black', 'color':'black'"; $f_conditions[] = $f; $g->set_conditional_css($f_conditions); $g->set_actions(array("add" => false, "edit" => true, "delete" => true, "rowactions" => true, "export" => true, "autofilter" => true, "search" => "advance")); // you can provide custom SQL query to display data $g->select_command = "SELECT i.id, invdate , c.name FROM invheader i\n\t\t\t\t\t\tINNER JOIN clients c ON c.client_id = i.client_id"; // this db table will be used for add,edit,delete $g->table = "invheader"; // pass the cooked columns to grid $g->set_columns($cols); // generate grid output, with unique grid name as 'list1' $out = $g->render("list1"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/themes/redmond/jquery-ui.custom.css"></link> <link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/jqgrid/css/ui.jqgrid.css"></link>
$f_conditions[] = $f; $f = array(); $f["column"] = "managerRating"; $f["op"] = "="; $f["value"] = "0"; // you can use placeholder of column name as value $f["cellcss"] = "'background-color':'#fcfdfd'"; $f_conditions[] = $f; $f = array(); $f["column"] = "awarded"; $f["op"] = ">"; $f["value"] = "0"; // you can use placeholder of column name as value $f["cellcss"] = "'background-color':'#a0e1a7'"; $f_conditions[] = $f; $grid->set_conditional_css($f_conditions); $out_master = $grid->render("list1"); // callback for add function add_invoice($data) { $upload_file_path = $data["params"]["note"]; // if file is uploaded if ($upload_file_path) { // your custom upload code goes here e.g. File DB insertion $f = pathinfo(realpath($upload_file_path)); $ext = pathinfo(realpath($upload_file_path), PATHINFO_EXTENSION); if ($ext != "pdf" && $ext != "gif" && $ext != "jpg" && $ext != "txt" && $ext != "doc" && $ext != "bmp" && $ext != "png") { unlink(realpath($upload_file_path)); phpgrid_error("Only pdf, gif, jpg, txt, doc, bmp, png files are allowed!"); } // rename file OR place folder