Announcement

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

    problem with custom inline control

    SmartClient Version: SNAPSHOT_v13.1d_2024-07-09/AllModules Development Only (built 2024-07-09)

    Hello, I just noticed that if I configure a custom inline control for a SelectItem like this:

    Code:
    isc.DynamicForm.create({
        ID: "testForm",
        width: 400,
        fields: [
            {
                name: "multipleSelect", title: "Select items", editorType: "SelectItem",
                optionDataSource: "supplyItem",
                optionCriteria: {units:"Ream"},
                displayField: "itemName", valueField: "itemID",
                multiple: true,
                pickListProperties: {
                    gridComponents: [
                        isc.ToolStrip.create({
                            height:30,autoDraw:false,
                            width: "100%",
                            members: [
                                isc.ToolStripButton.create({
                                    width:"100%",
                                    icon: "[SKIN]/actions/approve.png",
                                    title: "Check All",
                                    click:function() {
                                        var item = testForm.getField("multipleSelect"),
                                            fullData = item.pickList.data,
                                            cache = fullData.localData,
                                            values = [];
    
                                        for (var i = 0; i < cache.length; i++) {
                                            values[i] = cache[i]["itemID"];
                                        }
                                        item.setValue(values);
                                    }
                                })
                            ]
                        }),
                        "body"
                    ]
                }
            }
        ]
    });
    when I open it, the ToolStripButton is correctly at width 100%:

    Click image for larger version

Name:	2024-07-10 10.07.20.jpg
Views:	89
Size:	28.9 KB
ID:	272859

    but after clicking "Check All", it shrinks like this:

    Click image for larger version

Name:	2024-07-10 10.08.07.jpg
Views:	72
Size:	27.7 KB
ID:	272860

    is it a bug, or am I missing something?

    #2
    hi Claudio,

    It does look like there might be a framework issue here, where perhaps a grid with no fixed width overflows to fit data may not notify custom members of the resize. We'll take a look.

    In the meantime, one workaround would be to apply a fixed pickListWidth. Also, if all you want to do here is select all the items, you can just call item.pickList.selectAllRecords() - that way you don't call setValue() and cause a pickList hide/show, so you won't get the button resize.

    Comment


      #3
      Ah, a quick follow-up - selectAllRecords() does select all the records in the pickList, but doesn't apply them to the item.

      Leave it with us, we'll take a look at both and get back to you.

      Comment


        #4
        Hello, any news about this issue? At least that about selectAllRecords() which in fact solves also the button resize problem.

        Comment


          #5
          hi Claudio, apologies for the silence on this one. We've made a change to address this issue in tomorrow's builds - for the moment, you'll still need to call setValue(), something like

          Code:
          var item = testForm.getField("multipleSelect"),
          item.setValue(item.pickList.getData().getProperty("itemID"));
          We do have a couple of internal APIs that would allow you to do this more cleanly and we'll update here if we decide to expose those.

          Comment


            #6
            A quick follow-up - we've made a tweak so that calling pickList.select/deselectAllRecords() directly will update the item automatically, without running through setValue() and eventually moving/resizing the pickList. Please retest with tomorrow's builds.

            Code:
            // toggle selection of everything in the list
            var item = testForm.getField("multipleSelect");
            
            if (item.pickList.anySelected()) item.pickList.deselectAllRecords();
            else item.pickList.selectAllRecords();
            Last edited by Isomorphic; 6 Nov 2024, 03:25.

            Comment


              #7
              hi Claudio - in our example code, we showed using deselectAllRecords(), but note that we subsequently disabled this directly updating the item-value because it could run before draw and broke some internal autotests. We'll rework and reinstate it for tomorrow's builds.

              Comment


                #8
                SmartClient Version: v13.1p_2024-11-11/AllModules Development Only (built 2024-11-11)

                Hello, I see that the problem of post #1 is fixed, thank you very much.

                Regarding selection and deselection, I'm not sure if I fully understand your last two posts, but I noticed that while selectAllRecords() updates the item value, deselectAllRecords() does not. So is it actually intended to work like this? So to deselect I'll have to do item.setValue([]) ?

                Comment

                Working...
                X