Author Topic: Cell in Selected.Text  (Read 2718 times)

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 147
    • View Profile
Cell in Selected.Text
« on: March 20, 2014, 03:50:09 pm »
Hello Param,

I am using <select> in a cell in ParamGrid.
Values of the options are 1001,1002,1003, and texts are like "Inspection Formu", "Ek Dosya (Upload)"

When grid is first viewed , it shows user values as attached.
This is not easy to read. Therefore is it possible to Show the text when cell is selected?

As I could not do that I needed to Show it in 2 columns. But this is problem on user side.
« Last Edit: March 20, 2014, 03:52:04 pm by omerix »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Cell in Selected.Text
« Reply #1 on: March 21, 2014, 09:42:16 am »
I understand that you want to keep 'values' in the data but want to show 'text' in the cells.

You could use column.render callback to do that.

In this callback you get the value as ui.rowData[ui.dataIndx].

Next you can fetch the corresponding text to this value and return the text.

render(ui){
   var val = ui.rowData[ui.dataIndx];
   //get text corresponding to val depending upon your data structure of the select list options.
   return text;
}

If you don't want to reference select list options in the render callback, you can save data in this format {val: val, text: text} using editor.getData callback.

then you can easily reference text in render callback.

render(ui){
   var obj = ui.rowData[ui.dataIndx];
   //get text from obj
   return obj.text;
}
« Last Edit: March 21, 2014, 09:47:08 am by paramquery »