I’ve tried a couple of methods to change the aspect of cell content based on the cell value, and they both work, but the cell becomes uneditable. I mean the cell shows up in the edit window, but the modified value does not get saved into the database.
METHOD 1:
1 2 3 4 5 |
<style type="text/css"> .myrowclass td{ font-weight: bold !important; } </style> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$grid->setColProperty('accountnumber', array("label"=>"Account number", "width"=>"150", "fixed"=>true, "align"=>"center", "formatter"=>"integer", "formatoptions"=>array("thousandsSeparator"=>false), "editoptions"=>array("editrules"=>array("required"=>true)))); $myfunc = <<< ROWATTR >function (rowData, rowObject) { if(rowData.accountnumber % 1000 == 0 || rowData.accountnumber == 4500) { return { "class" : "myrowclass"}; } } ROWATTR; $grid->setGridEvent('rowattr', $myfunc); |
METHOD 2:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
$grid->setColProperty('accountnumber', array("label"=>"Account number", "width"=>"150", "fixed"=>true, "align"=>"center", "formatter"=>"js:accountGROUPS", "unformat"=>"js:unformat", "editoptions"=>array("editrules"=>array("required"=>true)))); $custom = <<<CUSTOM function accountGROUPS(cellValue, options, rowObject) { cellValue += ""; if(cellValue % 1000 == 0 || cellValue == 4500) { var cellHtml = "cellValue + "'>" + cellValue + ""; return cellHtml; } else { return cellValue; }} function unformat(cellValue, options, cellObject) { return $(cellObject.html()).attr("originalValue"); } CUSTOM; $grid->setJSCode($custom); |
<p>What am I doing wrong?</p>
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top