{"id":29686,"date":"2022-11-22T13:07:53","date_gmt":"2022-11-22T12:07:53","guid":{"rendered":"https:\/\/help.qualiware.it\/qw-help\/?p=29686"},"modified":"2023-12-09T01:03:07","modified_gmt":"2023-12-09T00:03:07","slug":"griglia-e-vistadati-cambio-colore-righe-in-base-al-valore-di-un-campo-vers-javascript","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\/","title":{"rendered":"Griglia e VistaDati: cambio colore righe in base al valore di un campo (vers. javascript &#8211; vecchio layout)"},"content":{"rendered":"<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\">\/\/ Il seguente snippet deve essere inserito nell'EventoRenderClient 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=false\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'][idx=\" + String(i) + \"]\").find(\"[role='gridcell']\").css(\"background-color\", \"lightskyblue\")\r\n    }\r\n    else {\r\n        grid.find(\"tr[role='row'][idx=\" + String(i) + \"]\").find(\"[role='gridcell']\").css(\"background-color\", \"\")\r\n    }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/\/ Il seguente snippet deve essere inserito nell&#8217;EventoRenderClient e consente di applicare uno stile differente alle righe in base al valore di una colonna (in questo caso FLAG1) \/\/ N.B. usare se NuovoLayout=false 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;][idx=&#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\/29686"}],"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=29686"}],"version-history":[{"count":4,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/29686\/revisions"}],"predecessor-version":[{"id":35157,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/29686\/revisions\/35157"}],"wp:attachment":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/media?parent=29686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/categories?post=29686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/tags?post=29686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}