rendering one field into two columns

rendering one field into two columns

keturnketurn Posts: 18Questions: 0Answers: 0
edited June 2010 in General
The rendering examples make it pretty clear how to combine two data fields in to one column, by hiding one and using a fnRender in the other. How would I go the other direction, and render one piece of data into two columns using two different rendering functions?

(My data structure has a single Date column. My front-end guys tell me they want separate columns for Day and Time. For the moment, I'm duplicating the field, but wondered if there was a better way.)

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yup it should be quite possible. What you will need to do is create an empty column in the table (prior to initialisation - this example shows how this might be done in JS if you don't want to do it in HTML: http://datatables.net/examples/api/row_details.html ), and then have a rendering function on each of the two columns that you want to use, which will take the information from the object passed to fnRender ( http://datatables.net/usage/columns#fnRender ) and built it up as needed.

    Regards,
    Allan
This discussion has been closed.