Announcement

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

    getGroupTitle not called

    Using 3.1d.2012-10-12:

    In a SelectItem I want to set a custom translated title on the grouping, but getGroupTitle is never called.


    ListGrid pickListProperties = new ListGrid() {
    @Override
    public String getGroupTitle() {

    pickListProperties.setGroupStartOpen(GroupStartOpen.ALL);
    setPickListProperties(pickListProperties);


    Can you please add support ?

    Thanks
    Last edited by damend; 5 Nov 2012, 07:58.

    #2
    You can use the setGroupTitleRenderer API of ListGridField to achieve this.
    You can see an example of custom grouping, including custom group titles here:
    http://www.smartclient.com/smartgwt/...rouping_custom

    Comment


      #3
      I tried

      labelNameField.setGroupTitleRenderer(new GroupTitleRenderer() {

      as well as
      labelNameField.setGroupValueFunction(new GroupValueFunction()

      but none of them is called as well.

      Can you have a look, please.

      I prepared an example for you. See atachment
      Attached Files
      Last edited by damend; 6 Nov 2012, 03:01.

      Comment


        #4
        The problem is that you're grouping by the lifeSpan field, but you're customizing the groupTitle and groupValue on the commonName field.

        If you set the groupTitle renderer on the field you're grouping by it is used to pick up the title of each group.
        If you set the groupValue function it'll be called to determine which group each record belongs to -- so if you modify your code to do this:
        Code:
                isGeneralField.setGroupTitleRenderer(new GroupTitleRenderer() {
        
                    @Override
                    public String getGroupTitle(Object groupValue, GroupNode groupNode, ListGridField field, String fieldName, ListGrid grid) {
                        return "NOT_CALLED_BUG";// I18nHelper.getMessage(i18n,
                                                // String.valueOf(groupValue));
                    }
                });
        
                isGeneralField.setGroupValueFunction(new GroupValueFunction() {
        
                    @Override
                    public Object getGroupValue(Object value, ListGridRecord record, ListGridField field, String fieldName, ListGrid grid) {
                        return "NOT_CALLED_BUG_AS_WELL";
                    }
                });
        You'll see every record gets lumped together in a single group (since they all return the same groupValue), and the title of that group is the "NOT_CALLED_BUG" string.

        Comment


          #5
          sorry for late response.

          Thank you, to recognize my mistake!

          Comment


            #6
            Grouping in a ListGrid, which is a picklistproperty of a SelectItem,
            using
            setAllowEmptyValue(true);

            will group the emptyvalue,
            which makes no sense, - a bug?
            Can you tell me how to solve it?

            Thank you
            Attached Files

            Comment


              #7
              The empty value, when shown in the pick-list basically corresponds to an "empty" record - A record with no meaningful properties.
              Such a record will be grouped with any other records which have no value for the groupByField.

              This makes sense, logically, but we can see why it's not what you were hoping for.
              There's no way to render the empty value separate from the grouped entries without a framework change.

              One option might be to supply a different UI for your use case, such as an additional "clear" icon which, when clicked, simply clears the item's value.

              Regards
              Isomorphic Software

              Comment

              Working...
              X