Combine data from multiple columns
Combine data from multiple columns
I'm trying to combine data from multiple columns. This works perfecty in the table itself with:
mData: null,
mRender: function (data, type, row) {
return row.City +', '+ row.State;
}
Now i want to do this within the editor screen but i cannot find a way to do this.
I want to combine the data in a select field.
Hope someone can help me out with this.
Thanks!
This discussion has been closed.
Answers
You can use
field.data
as a function in the same way as you can forcolumns.data
, but it is a little more complex than thecolumns.render
option since you need to handle theset
case as well (i.e. what to do when the value is set, not just being read).What is the reason that you want two individual fields to be combined into one? Do you then separate them back out at the server side?
Allan
Hello Allan,
I want to combine the initials and the lastname fields of a person in the database into a dropdown list in the editor screen. These are in separate fields now. If I make a dropdown list of persons with only the lastname, there is a big possibility to have duplicate names in it. With the initials in front of the lastname there is a less possibility.
I see - the
data
option doesn't populate the select list thought. That is theipOpts
/options
option that defines the list of options. Theupdate()
field method can also be used to populate the list.Allan
Thanks Allan! I'll give it a try.