Author Topic: I want to show labels instead of values ​​when doing Excel Export.  (Read 1343 times)

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 163
    • View Profile
Hello friends,

I have a column on the ParamQuery Grid where I make a user selection and I use select here. Since I don't have a chance to know the user ID value when logging in, I store it as id=value and display it as text=label.

I store the ID value in the database but I display the label (text) value on the grid.

Everything works correctly up to this point, but when I export the grid to Excel, dataIndx, that is, value (ID), appears instead of label.

Is the method I am using correct?

Code: [Select]
,{title:'User Select',dataIndx:'user4',dataType:'string',minWidth:24,width: 100,halign:'center',aciklama:'user4_name'
,hidden:false,editable:true,skipExport: true
,editModel:{ saveKey: $.ui.keyCode.ENTER, keyUpDown: false}
,editor:{type:'select',labelIndx:'label',valueIndx:'value',prepend: {'':'' },options: userList}
,render: function (ui) {return ui.rowData['user4_name']}
}

,{title:'User Name',minWidth:24,width:100,dataIndx:'user4_name',dataType:'string'
,hidden:true,editable:false,skipExport: false,exportRender:true
}


Matching formula with label:
Code: [Select]
formulas: [
['user4_name', rd => (userList.find(opt => opt.value == rd.user4) || {}).label || ""]
]


User list:
Code: [Select]
<script>
var userList = [
{"value":1031,"label":"Paramvir Dhindsa"},
{"value":1051,"label":"?merix Turk"},
{"value":1026,"label":"Bill Gates"}
]
</script>



paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6373
    • View Profile
Re: I want to show labels instead of values ​​when doing Excel Export.
« Reply #1 on: February 09, 2025, 03:21:47 pm »
Either pass render: true to exportData method or add exportRender: true to the column.

https://paramquery.com/pro/api#option-column-exportRender