Announcement

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

    #16
    You say the component must be “selectable” and apparently you think this implies there must be a SelectionChanged event.

    So that means someone in your codebase wrote code that requires this, because there is no such code in SmartGWT.

    And whether you wrote it or not, that’s the code that needs fixing.

    Again, your efforts to copy internal JSNI and produce a hack are worthless - they will break right away.

    Comment


      #17
      Hi Hirn,

      please show a screenshot with descriptions of what you are trying to achieve.
      If the CanvasItem is not enough, two CanvasItems (1st selection, 2nd selection) surly will be.

      I think a big problem so far has been to differentiate between selection (e.g. ListGrid, selecting one or multiple rows; TileGrid, selecting one or multiple tiles) and editing values in a DynamicForm. These are not the same things, and trying to mix them will create problems along the way. Selecting values, e.g. in a SelectItem, is still changing its value, and the correct handlers for this are around valueChanged, nothing to do with selection.

      Best regards
      Blama
      Last edited by Blama; 25 Oct 2023, 22:41.

      Comment


        #18
        >>So that means someone in your codebase wrote code that requires this, because there is no such code in SmartGWT.

        My task managers are not guided by SmartGWT.
        I had to either write a new component in GWT myself or adapt the component in SmartGWT.
        The second I have more or less succeeded with the least amount of time.
        If my solution ever breaks, then there will be nothing left but to write the component in pure GWT.

        Comment


          #19
          Click image for larger version

Name:	Zwischenablage-2.jpg
Views:	59
Size:	75.5 KB
ID:	271214 >>Selecting values, e.g. in a SelectItem, is still changing its value, and the correct handlers for this are around valueChanged, nothing to do with selection.

          I know how SelectItem works. There is no way to select the selected values in it. And that's what I need.
          That's why I started writing my own component.
          Last edited by Hirn; 26 Oct 2023, 01:53.

          Comment


            #20
            Hi Hirn,

            I think I finally understand your 2nd screenshot from #3.
            The long list is your dropdown and the top list is what you selected. Correct?

            This is just what MultiComboBoxItem does. Only difference to your case is how the unselected data is displayed. Is this it? Are you trying to rebuild that FormItem, but with a different display? If so, this high-level information would have really helped.
            Even if built-in MultiComboBoxItem is not what you want, CanvasItem + shouldSaveValue: true + storeValue() is still the way to go.

            Best regards
            Blama

            Comment


              #21
              In general I really like the idea of this FormItem. It can show more data than MultiComboBoxItem if your data is very short, like these ISO codes. But I assume building scrolling and paging into this might be difficult. But it will for sure work well for a limited dataset you set with setValueMap().

              Best regards
              Blama

              Comment


                #22
                >>CanvasItem + shouldSaveValue: true + storeValue() is still the way to go.

                Then tell me how do I distinguish between the selection from the drop-down list at the bottom and the selection from the top list? Which of these choices will cause storeValue()

                Comment


                  #23
                  These selections are the same, correct?
                  You show the bottom list once the item gets focus or something like that, correct?

                  So when you build the bottom list, create the buttons that are already in the value of the item (= in the top list) as selected. On click on those items in the 2nd list you act on both lists.
                  Deactivate in 2nd list: Remove from 1st list and call storeValue()
                  Activate in 2nd list: Add to 1st list and call storeValue()

                  Display of CanvasItem with data from the DB on load of the form: Build 1st list in your addShowValueHandler.

                  Possible enhancement: On click of a button in 1st list, remove it from 1st list, deactivate it in 2nd list (only needed if the list is currently being shown) and call storeValue().

                  Comment


                    #24
                    the drop-down list appears when you click on the icon on the right or double-click on the top list. When a drop-down list appears, it is filled with values from the ValueMap of the top list and at the same time all items from the top list are selected and if I select new or deselect old ones in the drop-down list, the list of items in the top list changes. I do this using storeValue() for the top list. That is, storeValue() is already occupied in the top list and I need a new property and event to select values in the top list.

                    >>Display of CanvasItem with data from the DB on load of the form: Build 1st list in your addShowValueHandler.

                    I also found this and I'm already using it in the new version of the component

                    Comment


                      #25
                      OK, so the values are not the same?

                      You select values from the bottom list AND THEN one can activate or deactivate them in the top list?

                      Then your value format changes, that's everything. Instead of:
                      Code:
                      ["ES", "DE", "EN"]
                      you store
                      Code:
                      ["ES,0", "DE,1", "EN,0"]
                      to show a list of ES, DE, EN on load via ShowValueHandler, but only DE activated.

                      And you call storeValue() from both lists - from the point of view of the CanvasItem it does not care whatever Widgets you build. It only cares about calls your to storeValue() and your ShowValueHandler.

                      Best regards
                      Blama

                      Comment


                        #26
                        >>OK, so the values are not the same?

                        exactly

                        >>Then your value format changes, that's everything. Instead of:
                        >>["ES", "DE", "EN"]
                        >>you store
                        >>["ES,0", "DE,1", "EN,0"]
                        >>to show a list of ES, DE, EN on load via ShowValueHandler, but only DE activated.

                        no, I have it saved like this for the top list right now...
                        values = ["ES", "DE", "EN"]
                        selectedValues = ["DE", "EN"]

                        if I didn't have to react to selection events in the top list, then I would just store values as an array of objects {value:"de", selected:true}
                        and if I react only to storeValue(), then I won't know if an item has been added to the top list or it has been selected
                        Last edited by Hirn; 26 Oct 2023, 02:59.

                        Comment


                          #27
                          Ok, then store this big string via storeValue() (and work with it in ShowValueHandler to build the 1st list):
                          Code:
                          values = ["ES", "DE", "EN"], selectedValues = ["DE", "EN"]
                          I don't see any remaining problem. You just change your widgets as needed when sth. is clicked and call storeValue().

                          Comment


                            #28
                            >>You just change your widgets as needed when sth. is clicked and call storeValue().

                            and then to find out in onchange whether the item was selected or added? I wonder why we don't do this in the List Grid? This is also possible if you only respond to onFetchData.

                            Comment


                              #29
                              Why is it important to know that?
                              You'd always have DynamicForm.oldValues. If this is about some logic that should happen to persisted data, you can't really rely on that - imagine having two browser windows open that both do changes. In this case, compare the values serverside and act on the difference, if needed.

                              Comment


                                #30
                                I don't know whether to open a new topic or who can answer here...
                                Is there an opportunity to add an event onEventResizeMove to CanvasItem.
                                this is necessary for the correct positioning of the drop-down list when scrolling the screen or if the size of the top list changes
                                Last edited by Hirn; 26 Oct 2023, 03:51.

                                Comment

                                Working...
                                X