Default uncheck specific checkboxes in the fields section when using setReport()

Answered
Edward Ding asked on August 1, 2023

How would I make it so by default in the image given, the Recipient Postal Code and below fields are unchecked by default and their columns are hidden. I am using setReport() and not runQuery(). I would like the checkboxes to just be unchecked and the columns to be hidden but when I do check the checkbox the column appears like usual.

5 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster August 2, 2023

Hello Edward,

Thank you for reaching out to us.

If we understand your request correctly, you're interested in checking the columns checkboxes via UI each time the report is set. It can be achieved using the showDefaultSlice property of the Options object:

  let report = {
    dataSource: {
      filename: "data/data.csv"
    },
    options: {
      grid: {
        type: "flat"
      },
      showDefaultSlice: false,
    }
  }
  flexmonster.setReport(report);

You are welcome to check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/fhzxko5r/ 
Also, could you please let us know if you already have Flexmonster license? This will help us to better analyze your use case based on our internal records.

Looking forward to hearing from you.

Kind regards,
Nadia

Public
Edward Ding August 2, 2023

I want some specific fields to default as unchecked while others are checked and visible. 

Public
Edward Ding August 2, 2023

How do I make a specific few fields in there unchecked and their columns hidden while the other ones default as checked and their columns shown.

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster August 3, 2023

Hello,

Thank you for the details.

To show the specific columns on the grid, you can define the slice property of the Report Object:

  let report = {
    dataSource: {
      filename: "data/data.csv"
    },
    slice: {
      columns: [{
          uniqueName: "Category"
        },
        {
          uniqueName: "Color"
        },
        {
          uniqueName: "Size"
        },
      ]
    },
    ...
  }
  flexmonster.setReport(report);

Feel free to check the following JSFiddle: https://jsfiddle.net/flexmonster/rpgeL52h/

Please let us know if it works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster August 16, 2023

Hello,

Hope you are doing well.

We were wondering if you had a chance to check the suggested solution. Could you please let us know if it works for you?

Looking forward to hearing your feedback.

Kind regards,
Nadia

Please login or Register to Submit Answer