jcnreds jcnreds - 1 year ago 183
JSON Question

Handsontable : How to choose which data to load?

I have a json :


I want handsontable to load only name, age, but I don't know how to that :(

I think I should make a new object which only has name and age => load to handsontable. Can I do that?

Can anyone help me? Thank you very much :D

Answer Source

There are several ways to do this. You could do it the way you initially suggested and modify your JSON object to only return those fields. Or, you could do it like this:

var data = [

var hot = new Handsontable(container, {
  data: data,
  colHeaders: ['Name', 'Age'],
    columns: [
      {data: 'name'},
      {data: 'age'}

Using the colHeaders and columns options as in my example above gives you more flexibility with your data on the front end. :)

Working fiddle

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download