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

    changing default editor for ListGrid boolean

    SmartClient Version: v12.0p_2019-04-23/LGPL Deployment (built 2019-04-23)
    Chrone Version 74.0.3729.131 (Official Build) (64-bit)

    I want boolean values edited on all ListGrids to use a different, smaller, checkbox style than checkboxes in DynamicForms. This is the approach I came up with from digging through the SC source code, but I suspect it's not the best way.


      getFieldType : function skin_ListGrid_getFieldType(field, values) {
          return "boolean" === field.type ? "SmallCheckboxItem" : field.type;
    isc.ClassFactory.defineClass("SmallCheckboxItem", "CheckboxItem").addProperties({
      checkedImage: "sprite:cssClass:checkboxSmallTrue;size:18,18",
      uncheckedImage: "sprite:cssClass:checkboxSmallFalse;size:18,18",
    Is there a cleaner way to accomplish this?

    We wouldn't recommend doing this from a UE perspective - you are making two editors with identical functionality look different, which seems like it can only confuse the user. Also, if you make it smaller, it's going to end up being harder to hit on mobile. Also, right now the same row would look different when edited vs when not, because you haven't customized listGrid.booleanTrueImage/FalseImage.

    As far as how this would be done, your approach with getFieldType is wrong in a few ways:
    1. you can't just replace methods on ListGrid, as that would destroy the original method. If you want to override something, create a subclass and use that subclass pervasively
    2. getFieldType isn't documented
    3. getFieldType doesn't actually exist even as an undocumented API, so your attempt does nothing..

    The right way to do this, if you want it as a repeating behavior, is to use your own subclass of ListGrid pervasively, and have it always change the editorType on boolean fields to your special checkbox.


      Thanks for the quick feedback.