Writing custom formatters for slick grid

风流意气都作罢 提交于 2019-12-04 14:50:05

"dataContext" is the data item that the cell for the row being rendered is bound to.

Aamir Shaikh

To make it more simple,

I wrote this function where i defined my slickgrid and then passed my function to the formatter

    function roundOffValuesFormatter (row, cell, value, columnDef, dataContext) {
        if(dataContext[cellID] || dataContext[cellID]) {
         return Math.round(value*100)/100;  
        } 
    }

and now call this formatter,

{id:'cellID', field:'cellID', name:'Name', width:90, editor:Slick.Editors.Text, formatter: roundOffValuesFormatter}

Now, customize it according to your requirement.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!