jquery - customizeText devextreme not working -


datagrid = $("#gridcontainer").dxdatagrid({    columns: [{      datafield: "stcg",      caption: "stcg",      format: 'fixedpoint',      allowfiltering: false,      precision: 2,      customizetext: function(cellelement, cellinfo) {        var fielddata = cellinfo.value;          if (fielddata >= 0) {          cellinfo.cellelement.addclass("greencolortext");        } else {          cellinfo.cellelement.addclass("redcolortext");        }      }    }]  }).dxdatagrid("instance");
.greencolortext {    color: #2dc48d;  }    .redcolortext {    color: #bf4e6a;  }

i trying change font color of data in cell if data in greater or equal 0 text green else red

the customizetext method doesn't take 2 arguments. if open browser console see javascript errors.

in case can use celltemplate option:

celltemplate: function($cell, cellinfo) {     var fielddata = cellinfo.data.stcg;     if (fielddata >= 0) {         $cell.addclass("greencolortext");     } else {         $cell.addclass("redcolortext");     }      $cell.append(cellinfo.text); } 

demo.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -