Author Topic: colModel instead of index number Can we use the name dataIndx-fieldname  (Read 71 times)

necatiozbek

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 19
    • View Profile
 obj_grid.colModel[5].render= function (ui)
{
...
..
}


Can we use dataIndx-fieldname instead of index number
instead of Wouldn't it be nice if we could use. Because even if we change the model location, we do not have to make any changes in the function.


 obj_grid.colModel['fieldname'].render= function (ui)
{
...
..
}

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
colModel is an array of columns, so it can be written like this

obj_grid.colModel.find( col => col.dataIndx == 'fieldname').render = function (ui){...}
« Last Edit: July 24, 2024, 07:26:36 am by paramvir »