Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    12.0p ListGrid formatValue problem with canFilter:false

    Hi Isomorphic,

    I was trying to recreate another issue, when I noticed this issue with formatValue in combination with canFilter:false, where the string is also applied in the filterRow.
    Please see this modified sample (v12.0p_2020-04-10):
    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:224, alternateRecordStyles:true,
        data: countryData, showFilterEditor: true,
        fields:[
            {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png"},
            {name:"countryName", title:"Country"},
            {name:"independence", title:"Nationhood", type:"date", width: "25%",
                formatCellValue: function (value) {
                    if (isc.isA.Date(value)) {
                        return (new Date().getYear() - value.getYear()) + " years ago";
                    }
                }
            },
            {name:"area", title:"Area", type:"number", canFilter:false,
                formatCellValue: "isc.NumberUtil.format(value, ',0') + ' km²'"
            }
        ]
    })
    Click image for larger version

Name:	formatValue.PNG
Views:	95
Size:	19.9 KB
ID:	261864

    Best regards
    Blama

    #2
    canFilter means *the end user* may not filter this field, but it doesn't mean that there isn't a fixed filter value for that field, which should be shown to the user. You just need to upgrade your formatter to handle null.

    Comment


      #3
      Hi Isomorphic,

      I'd still expect there no text, see here:
      Code:
      isc.ListGrid.create({
          ID: "countryList",
          width:500, height:224, alternateRecordStyles:true, canEdit: true,
          data: countryData, showFilterEditor: true,
          fields:[
              {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png"},
              {name:"countryName", title:"Country"},
              {name:"independence", title:"Nationhood", type:"date", width: "25%",
                  formatCellValue: function (value) {
                      if (isc.isA.Date(value)) {
                          return (new Date().getYear() - value.getYear()) + " years ago";
                      }
                  }
              },
              {name:"area", title:"Area", type:"number", canFilter:false,
                  formatCellValue: function(value) {if (value==null) return 'no area'; else return isc.NumberUtil.format(value, ',0') + ' km²'}
              }
          ]
      })
      "no area" is a valid thing to display there (just edit and remove a value), but not in the filterRow.

      Best regards
      Blama

      Comment


        #4
        After some internal discussion, we've decided we agree with you - the formatter should be suppressed for empty criteria in canFilter:false fields.
        We've made a change to address this which will be present in nightly builds going forward (April 11 and above).
        There is also a new boolean flag - RecordEditor.suppressNullValueFormat - which can be set to false on filterEditorProperties to disable this and allow the static formatter to run in this case.

        Regards
        Isomorphic Software

        Comment


          #5
          Hi Isomorphic,

          I can see the new attribute and it's working like expected by default now in the sample from #1 (v12.0p_2020-04-12) as well as here with the new attribute:
          Code:
          isc.ListGrid.create({
              ID: "countryList",
          [B]filterEditorProperties: {suppressNullValueFormat: false},[/B]
              width:500, height:224, alternateRecordStyles:true, canEdit: true,
              data: countryData, showFilterEditor: true,
              fields:[
                  {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png"},
                  {name:"countryName", title:"Country"},
                  {name:"independence", title:"Nationhood", type:"date", width: "25%",
                      formatCellValue: function (value) {
                          if (isc.isA.Date(value)) {
                              return (new Date().getYear() - value.getYear()) + " years ago";
                          }
                      }
                  },
                  {name:"area", title:"Area", type:"number", canFilter:false,
                      formatCellValue: function(value) {if (value==null) return 'no area'; else return isc.NumberUtil.format(value, ',0') + ' km²'}
                  }
              ]
          })
          Best regards
          Blama

          Comment

          Working...
          X