{"id":35562,"date":"2024-01-18T16:44:26","date_gmt":"2024-01-18T15:44:26","guid":{"rendered":"https:\/\/help.qualiware.it\/qw-help\/?p=35562"},"modified":"2024-01-18T16:54:25","modified_gmt":"2024-01-18T15:54:25","slug":"griglia-e-vistadati-cambio-colore-righe-in-base-al-valore-di-un-campo-vers-javascript-nuovo-layout-2","status":"publish","type":"post","link":"https:\/\/help.qualiware.it\/qw-help\/griglia-e-vistadati-cambio-colore-righe-in-base-al-valore-di-un-campo-vers-javascript-nuovo-layout-2\/","title":{"rendered":"Griglia e VistaDati: cambio colore righe in base al valore di un campo (vers. javascript &#8211; nuovo layout)"},"content":{"rendered":"<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\">\/\/ Il seguente snippet deve essere inserito nell'EventoDatiCaricatiClient e consente di applicare uno stile differente alle righe in base al valore di una colonna (in questo caso \"FLAG1\")\r\n\/\/ N.B. usare se NuovoLayout=true\r\n\r\nlet grid = $('#&lt;Grid1&gt;')\r\n\r\nfor (i = 0; i &lt; grid.rowCount(); i++) {\r\n    if (grid.getCellValue(i + 1, \"FLAG1\")) {\r\n        grid.find(\"tr[role='row'][data-rowindex=\" + String(i) + \"]\").find(\"[role='gridcell']\").css(\"background-color\", \"red\").css('color',\"white\")\r\n    }\r\n    else {\r\n        grid.find(\"tr[role='row'][data-rowindex=\" + String(i) + \"]\").find(\"[role='gridcell']\").css(\"background-color\", \"\").css('color',\"\")\r\n    }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/\/ Il seguente snippet deve essere inserito nell&#8217;EventoDatiCaricatiClient e consente di applicare uno stile differente alle righe in base al valore di una colonna (in questo caso &#8220;FLAG1&#8221;) \/\/ N.B. usare se NuovoLayout=true let grid = $(&#8216;#&lt;Grid1&gt;&#8217;) for (i = 0; i &lt; grid.rowCount(); i++) { if (grid.getCellValue(i + 1, &#8220;FLAG1&#8221;)) { grid.find(&#8220;tr[role=&#8217;row&#8217;][data-rowindex=&#8221; + String(i)&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"ngg_post_thumbnail":0,"footnotes":""},"categories":[65],"tags":[88],"acf":[],"_links":{"self":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/35562"}],"collection":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/comments?post=35562"}],"version-history":[{"count":2,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/35562\/revisions"}],"predecessor-version":[{"id":35564,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/35562\/revisions\/35564"}],"wp:attachment":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/media?parent=35562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/categories?post=35562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/tags?post=35562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}