Announcement

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

    hiding grouping column

    I've found a few posts about this but none of them I saw were actually answered.

    Here's my problem - I have a listgrid, by default grouped by Continent. When the listgrid is rendered, the grouping shows up correctly but the column is also showing so I end up with redundant data. Is this desired behaviour? I tried working around it by setting showIf on the column (code provided below) and it works initially..but if I ungroup by continent, the column does not reappear. I also know that showIf is only called during initial rendering and if refreshFields is called so I dont even think this is the right place to do it if anything. How do you recommend making this behaviour work?

    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:522, height:224,
        alternateRecordStyles:true, cellHeight:22,
        dataSource: countryDS,
        fields:[
            {name:"countryName"},
            {name:"government"},
            {name:"continent"}
    		},
            {name:"countryCode", title:"Flag", width:40, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png", canEdit:false}
        ],
        groupStartOpen:"all",
        groupByField: 'continent',
        autoFetchData: true
    
    })
    Code:
    			showIf: function(list, field, fieldNum){
    				if(list.canGroupBy){
    					var groupList = list.getGroupByFields();
    					for(var i = 0; i< groupList.length;i++){
    						if(groupList[i] == field.name){
    							return false;
    						}
    					}
    				}
    				return true;//return this.Super("showIf",[list,field,fieldNum]);

    #2
    Yes, it's desired behavior because if the grid is editable you would be unable to edit the field being grouped on. You also lose the header, so you can't easily sort by clicking. Further, if you had added any kind of event handling or behavior for the grouped field it would become inaccessible.

    So, you would want to be rather selective about which grids should auto-hide the group column, because it would be clearly undesirable in some. And at that point, since some grids would clearly not want to auto-hide the group column, you would have inconsistent behavior that would surprise users.

    Given this, are you still interested in pursuing this?

    Comment


      #3
      Good point - thanks. We'll leave the column

      Comment

      Working...
      X