Set selected drop down option using the label

Set selected drop down option using the label

dynasoftdynasoft Posts: 439Questions: 68Answers: 3

Hi

I have a select drop down where the label is set with a meaningful label using the value stored from the db. I set the value pair with this value from the db. This is for populating the datatable. However, I need to use the value when showing the options and setting the selected option in th editor. Currently I get no selected value because editor is not able to use the label for setting the selected entry. How can I select using the label (I think editor selects using the value) or is there a way to store the value somewhere to use it when working with the editor? Many thanks.

Answers

  • dynasoftdynasoft Posts: 439Questions: 68Answers: 3

    Hi, I think I need to do this in the page's editor code using renderers. Is that correct?

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    Let me check my understanding first: the Editor works correctly with the label / values, but DataTables is showing the value and you want it to show the label?

    The best way of doing this is to do a left join in your data source so the data for the row contains both the value and the label - this is used here and described more fully in the manual.

    The other option is indeed to use columns.render to lookup the value from a list and then return the corresponding label.

    Allan

This discussion has been closed.