Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81920

Initialize a single-column table with a plain array

$
0
0

I'd like to initialize a single-column table with a plain array.
Doing the following results in each row having the first letter of each array item (Of course, that's not what I need):

var dataArr = ["James", "Joe", "John"]
var table = $('#exampleTable').DataTable({
    data: dataArr,
  columns: [{title: "Name"}]
});

Now, doing the following works, but it would require me to wrap each item in an array of its own, which is undesirable:

var dataArr = [["James"], ["Joe"], ["John"]]
var table = $('#exampleTable').DataTable({
    data: dataArr,
  columns: [{title: "Name"}]
});

Is there some initialization option I can use to make the plain array work?


Viewing all articles
Browse latest Browse all 81920

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>