Skip to content

labels function not called #10

Closed
Closed
@doublej42

Description

@doublej42

Template

<JsonCSV
      :data="json_data"
      :fields="getCSVFields"
      :labels="getCSVLabels"
    >
Download
    </JsonCSV>

Code:

import JsonCSV from "vue-json-csv";

export default {
  components: {
    JsonCSV
  },
  data() {
   json_data: [
            {
                'name': 'Tony Peña',
                'city': 'New York',
                'country': 'United States',
                'birthdate': '1978-03-15',
                'phone': {
                    'mobile': '1-541-754-3010',
                    'landline': '(541) 754-3010'
                }
            },
            {
                'name': 'Thessaloniki',
                'city': 'Athens',
                'country': 'Greece',
                'birthdate': '1987-11-23',
                'phone': {
                    'mobile': '+1 855 275 5071',
                    'landline': '(2741) 2621-244'
                }
            }
        ]
    }
}
  },
  methods: {
    getCSVFields: function(value,key)
    {
//console.log in here gets called fine
      if (key == 'groupColor')
      {
        return false
      }
      return true;
    },
    getCSVLabels: function(value,key)
    {
      console.log('getCSVLabels',value,key)
//this doesn't show in my console
      return key+value;
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions