Author Topic: How to bind dropdown in pqgrid with Id and Name  (Read 443 times)

developer1

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 44
    • View Profile
How to bind dropdown in pqgrid with Id and Name
« on: June 10, 2022, 07:14:15 pm »
We have a scenario to bind Id as a value and Name as a Field  in dropdown

Could you provide us a demo for that?

Id=1 Field='India'
Id=2 Field='Us'
Id=3 Field='Australia'

When We select India from dropdown then prompt the message, You have selected 1 Id

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How to bind dropdown in pqgrid with Id and Name
« Reply #1 on: June 13, 2022, 10:17:21 am »
Please check ShipVia3 column in this example: https://paramquery.com/pro/demos/editing_custom

It has options in the same format.

And use this code in column.editor.init to alert the value of dropdown.

Code: [Select]
init: function(ui){
ui.$editor.on('change', function(evt){
//alert($(evt.target).find('option:selected').text());
alert($(evt.target).val());
});
}