Combine data from multiple columns

Combine data from multiple columns

OlanOlan Posts: 41Questions: 11Answers: 1
edited December 2014 in Editor

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!

Answers

  • allanallan Posts: 61,832Questions: 1Answers: 10,133 Site admin

    You can use field.data as a function in the same way as you can for columns.data, but it is a little more complex than the columns.render option since you need to handle the set 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

  • OlanOlan Posts: 41Questions: 11Answers: 1

    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.

  • allanallan Posts: 61,832Questions: 1Answers: 10,133 Site admin

    I see - the data option doesn't populate the select list thought. That is the ipOpts / options option that defines the list of options. The update() field method can also be used to populate the list.

    Allan

  • OlanOlan Posts: 41Questions: 11Answers: 1

    Thanks Allan! I'll give it a try.

This discussion has been closed.