Announcement

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

    Customizing filter for DateTimeItem

    SmartClient Version: v9.1p_2014-07-13/LGPL Development Only (built 2014-07-13)

    I've done a lot of customization of styles that affect the look of the FilterBuilder control. Most of this is working very well. However my DateTime item when you pick something like "greater than or equal to" shows a field next to it for my "N minutes from now" and a value. However the field that shows the "N minutes from now" is too narrow (see attached screen shot).

    For most of my customization of these items I have been able to set up autoChild properties. Is there an autoChild I can set properties on to control the width of this control? If so, what is the name of the autoChild? Is there somewhere I can find documentation on things like a DateTimeItem to get a complete list of the autoChild names and what they are associated with?
    Attached Files

    #2
    That's the relativeDateItem.valueField AutoChild. Note the special property valueFieldWidth that provides direct control over the width property here - the notes here may explain what changes you've made would have led to a bad default size as shown in your screenshot.

    To discover the AutoChildren of any given component, just search for AutoChild in that components' docs. We've set up the wording of the auto-generated docs so this keyword always appears.

    Comment


      #3
      Actually, if you meant the sub-component that show's the actual quantity for an "N units from/since ..." -type value, the that's the relativeDateItem.quantityField AutoChild - the valueField autoChild is the picker to the left.

      Comment


        #4
        It was the picker that I needed, but thank you for telling me both anyway.

        Comment


          #5
          I tried searching the RelativeDateItem docs at the following address:

          http://www.smartclient.com/smartgwt/javadoc/

          for the text "AutoChild". None of the occurrences that I found on that page mentioned anything about the names of the two auto children you referred me to in this thread. I have never been able to find the name of the AutoChild properties this way in the docs as you suggested. Am I looking in the correct place?

          Comment


            #6
            Just scanning the RelativeDateItem documentation at the URL you linked to for "AutoChild" clearly highlights getQuantityField() and getValueFieldComboBox().

            However, in the case of the value-field, the autoChild name *is* "valueField". We'll take a look at that.

            Comment


              #7
              Ah, I see now, thanks for the clarification.

              Comment


                #8
                Setting the autoChild properties is not working properly for me. I don't know if you are going to need a standalone example of this or not. I'll start with just trying to describe the issue and if you need code I'll work something up.

                I'm bringing up the filter builder with a filter that has a relative date in it with a "N minutes from now" "0" settings. Before I try to set the auto child, the filter builder control shows these fields with the correct values in them, but the picker field is too narrow. I then added the following to my code:

                Code:
                RelativeDateItem.setDefaultProperties(new RelativeDateItem() {
                  {
                    ComboBoxItem properties = new ComboBoxItem();
                    properties.setWidth(100);
                    setAutoChildProperties("valueField", properties); //$NON-NLS-1$
                  }
                });
                Now when I bring up the control, the field width is fine, but the picker field is blank instead of showing "N minutes from now" and the value field is 1 instead of 0.

                Am I doing something wrong? I set the widths on the hourItemDefaults, minuteItemDefaults, and ampmItemDefaults on the TimeItem using the same pattern. Is the issue that there is no valueFieldDefaults autoChild?

                Comment


                  #9
                  For the valueField, there is the special API setValueFieldWidth() - see the doc for that

                  Comment


                    #10
                    Sorry for the misdirect about autoChild. I thought I was going to need to use the same technique I had elsewhere and missed your reference to the method in the class for this.

                    However, this is not working for me. I changed the code to:

                    Code:
                    RelativeDateItem.setDefaultProperties(new RelativeDateItem() {
                      {
                        setTimeUnitOptions(TimeUnit.MINUTE, TimeUnit.HOUR, TimeUnit.DAY, TimeUnit.WEEK, TimeUnit.MONTH);
                        setUse24HourTime(DATE_TIME_CONSTANTS.use24HourClock());
                        setValueFieldWidth(500);
                      }
                    });
                    and the control now shows the correct values in the value and quantity fields, but the width of the value field does not change at all (it is not 500, it is still the same narrow width as it was without any of this code). If I comment out the setTimeUnitOptions call, then the setValueFieldWidth call works.

                    Comment


                      #11
                      Which base skin are you using?

                      Comment


                        #12
                        Note that, when we try the techniques you show examples of, both work as expected for us - so, this is related either to your base skin (we tested Enterprise), or to the changes you've made to it, or to other code you haven't shown.

                        Comment


                          #13
                          I'm using Enterprise. Must be so interaction with other customization we've done. I'll try to narrow it down more when I get back from vacation next week.

                          Comment

                          Working...
                          X