Author Topic: How to display the select box text?  (Read 775 times)

luckduck

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 43
    • View Profile
How to display the select box text?
« on: December 22, 2020, 02:48:18 pm »
Hi

I want to display the text of the selected option in the edit state when it is in the general grid state.
The options value is an array of associated value label pairs.

Code: [Select]
        var data = [
            { rank: 1, company: 'Exxon Mobil', revenues: 339938.0, profits: 36130.0 },
            { rank: 2, company: 'Wal-Mart Stores', revenues: 315654.0, profits: 11231.0 },
            { rank: 3, company: 'Royal Dutch Shell', revenues: 306731.0, profits: 25311.0 },
            { rank: 4, company: 'BP', revenues: 267600.0, profits: 22341.0 }
        ];

  var CM = [
                { title: "Rank", width: 100, dataIndx: "rank", editor: {type: "select", prepend: {"":""}, options: [{"1":"one"}, {"2": "two"}, {"3": "three"}, {"4": "four"}]} },
                { title: "Company", width: 200, dataType: "string", dataIndx: "company" },
                { title: "Revenues", width: 150, dataType: "float", dataIndx: "revenues", format: '#.0' },
                { title: "Profits", width: 150, dataType: "float", dataIndx: "profits", format: '#.0' }
            ];


Below is the link of the jsfiddle:

https://jsfiddle.net/54vucynL/

Thank you.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 5228
    • View Profile
Re: How to display the select box text?
« Reply #1 on: December 22, 2020, 03:20:21 pm »
[ Only Pro members may read this post. ]

luckduck

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: How to display the select box text?
« Reply #2 on: January 04, 2021, 11:34:42 am »
Thank you for your reply.

When generating the grid, if the data ranks 1, I want to display it as one.

And when I save, I want to save 1, not one.

Is there any possible way?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 5228
    • View Profile
Re: How to display the select box text?
« Reply #3 on: January 04, 2021, 01:15:50 pm »
[ Only Pro members may read this post. ]