Custom filter JS

I’ve added my own custom js script on custom filter. In my settings , ive added

f.settings = function() {
  return [
    {
      id: 'Group',
      defaultValue: 'false',
      type: 'Boolean'
    }
  ];
}

  f.afterDraw = function(){
    let chk_boolean = arcapi.getSetting('Group')
    let result = (chk_boolean === true)?'This is true' :'This is false';
    console.log(result)
   } 

whenever i tried to log the chk_boolean on arcadia , its not returning me the right value if its true nor false. Why is that so ? i know there is nothing wrong with my syntax and i am confused why its not working . For an example,

console.log(chk_boolean)
this will display true, when i set it to false and create an if else condition . it will still return as true .

Any Ideas ?

Updated
I have already solved my problem,the problem was very simple. when i did a type of to see what variable type its returning. i got my answer. Basically, boolean type have to be comparedas string. so instead of chk === true . it should be chk==='true'

1 Like