Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Vue setFieldValue sorting based on keys on its own

I’ve this function I use to upload from csv and save the details in an array and save it

getArray(row) {
  let getDetail = []
  if (row['comment'].trim().length > 0) {
    this.setFieldValue(getDetail, 'Comments', row['comment'])
  }
  if (row['start'].trim().length > 0) {
    this.setFieldValue(getDetail, 'Start Date', this.dateFormat(row['start']))
  }
  if (row['end'].trim().length > 0) {
    this.setFieldValue(getDetail, 'End Date', this.dateFormat(row['end']))
  }
  return getDetail
},

The issue is getDetail is automatically sorted based on keys, so on UI on the table I am displaying it using v-for

I’ve order as -> Comment, End date, Start date
where as the required is -> Comment, Start date, End date

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The correct solution is to avoid using the name as key.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading