Transform javascript data source into HTML form elements?

Transform javascript data source into HTML form elements?

ifaceiface Posts: 23Questions: 8Answers: 0

We've been using Javascript sourced data with a DataTable for a while now. It works great.

What's the preferred technique to transform the data into HTML form elements like inputs or selects? I found the createdRow callback but I'm not clear this is the best way.

For example if I had this row of data and I wanted each item to render as an input element in the TD.
['Trident','Internet Explorer 4.0','Win 95+','4','X']

The first item might look something like this.
<input type="text" value="Trident" />

This question has an accepted answers - jump to answer

Answers

  • ifaceiface Posts: 23Questions: 8Answers: 0

    I'm using version 1.9.4 and can't upgrade right now. It seems there are a number of ways to accomplish this transformation. I'm confused about the correct approach.

    If my data source is an object and not an array. Should I be using mData() to assign the source property and then use mRender() to change the data values into HTML form elements?

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin
    Answer ✓

    I would suggest columns.render would probably be the best way.

    Allan

This discussion has been closed.