aslagle / reactive-table

A reactive table designed for Meteor
https://atmospherejs.com/aslagle/reactive-table
Other
328 stars 137 forks source link

passing an array #360

Closed logtomadhu closed 8 years ago

logtomadhu commented 8 years ago

Hi

Am new to meteor and javascript.

Am having two sets of array , 1.array which contains a table head 2.nested array contains table data.

how can i pass the key and label using this array

Suggest me how to solve this problem?

aslagle commented 8 years ago

So your data is something like this?

head: ["Column 1", "Column 2"] data: [["column 1 value", column 2 value"], ...]

You can pass the data array in as is, but for the head you'll need a new array with the array indexes converted to strings as keys, eg [{key: "0", label: "Column 1"}, {key: "1", label: "Column 2"}].

If you don't want to create it manually, try something like:

_.map(tableHeadArray, function (value, index) {
  return {key: String(index), label: value};
});
logtomadhu commented 8 years ago

Thanks a lot , Its working