How can I have a cntr column in dhxGrid


#1

There is a cntr column type in dhx5, it’s useful. I cannot find it in dhx7, is it supported now, or any other solution? Thanks


#2

You may try to use the column template for the column formatting:
https://docs.dhtmlx.com/suite/grid/customization/#adding-template-to-cells


#3

Thank sematik. It‘s useful.

that=this;
var mygrid = new GridDHX(null, {
  data: this.mydata,
  columns: [
      {
        id: "cntr",
        header: [{ text: "序号", align: "center" }],
        template:function(text,row,col){
            return that.mydata.getIndex(row.id)+1;
        },
      },
  ],
});

image