Announcement

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

    BUG SectionItem header controls broken in version 13.0

    We add a component to the SectionHeader of the SectionItem in DynamicForm. This was working well in SmartClient 12.1 but is broken in 13.0.
    It can be easily reproduced in the Feature Explorer (showcase), by adding a canvasProperties, as follows:

    /*
    * Fails in: https://smartclient.com/smartclient-...d=formSections
    * Works in: https://smartclient.com/smartclient-...d=formSections
    *
    */
    //BEGIN SectionItem bug sample
    isc.DynamicForm.create({
    width: 350,
    titleWidth:120,
    fields: [
    { defaultValue:"Item", type:"section", sectionExpanded:true,
    itemIds: ["itemName", "description", "price"]

    // Add a SectionHeader control: works in 12.1 but not in 13.0
    ,canvasProperties: { controls: isc.IButton.create({title: "X", autoFit: true})}

    },
    { name:"itemName", type:"text", title:"Item"},
    { name:"description", type:"textArea", title:"Description"},
    { name:"price", type:"float", title:"Price", defaultValue:"low"},
    { defaultValue:"Stock", type:"section", sectionExpanded:false,
    itemIds: ["inStock", "nextShipment"]
    },
    { name:"inStock", type:"checkbox", title:"In Stock" },
    { name:"nextShipment", type:"date", title:"Next Shipment", useTextField:true, wrapTitle:false}
    ]
    });
    //END SectionItem bug sample

    We have tracked the problem down, and propose a fix below. The !isc.isA.SectionStack(stack) check is too restrictive. It prevents a SectionHeader within a SectionItem from seeing the controls. This is only a quick fix which works for us so far. I have not done an investigation of all the SectionStack, SectionHeader changes made in SmartClient 13.

    version v13.0p_2023-11-20, ISC_Foundation.js, line 24896

    addControls : function () {
    var stack = this.getSectionStack();
    // Section headers may be created without an associated section stack
    // In this case we can't invoke createSectionControls()

    /* START Replace (by DaveC)
    if (stack == null || !isc.isA.SectionStack(stack)) {
    return;
    }
    var controls = stack.createSectionControls(this);
    with */
    var controls;
    if (stack == null || !isc.isA.SectionStack(stack)) {
    controls = this.controls;
    if (controls && !isc.isAn.Array(controls)) controls = [controls];
    } else {
    controls = stack.createSectionControls(this);
    }
    /* END Replace */

    if (controls == null || controls.length == 0) return;

    var isRTL = this.isRTL();
    var controlsSnapTo = this.getControlsSnapTo();


    this.addAutoChild("controlsLayout", {
    height:this.getInnerHeight(),
    align:isRTL ? "left" : "right",
    snapTo:controlsSnapTo,
    members: controls,
    resized : function () {
    var label = this.creator,
    background = this.creator.background;
    if (background != null) label = background.label;
    label.markForRedraw();
    }
    });
    this.allowContentAndChildren = true;
    },

    Many thanks

    #2
    Thanks for the clear description and patch code. We've made a change to resolve this issue and reintroduce support for SectionItem controls in 13.0 and 13.1
    Please try the next nightly build dated Dec 1 or above

    Regards
    Isomorphic Software

    Comment

    Working...
    X