【问题标题】:Smartgwt ListGrid Group orderSmartgwt ListGrid 组顺序
【发布时间】:2017-05-03 11:35:04
【问题描述】:

我有一个包含 3 列的 ListGrid,其中一个是隐藏的,但它不会改变任何问题。 我想对第三个隐藏字段的值进行分组,一个日期。当此日期不存在(空)时,我想将记录放在“实际项目”组中,否则它们会放在“已关闭项目”组中。 它可以工作,但我想首先拥有组实际项目,我尝试了很多关于字段和网格的排序方向以及baseTitle 我返回的事情。它永远不会改变我总是首先拥有具有非空值的组。 我错过了什么吗?有人体验过团购吗?

   final int groupClosed = 2;
    final int groupActual = 1;


    colonneDate.setGroupValueFunction(new GroupValueFunction() {  
        public Object getGroupValue(Object value, ListGridRecord record, ListGridField field, String fieldName, ListGrid grid) {  
            Date laDate = (Date)value;            
            if(laDate == null) {  
                return groupActual;  
            } else {  
                return groupClosed;  
            }
        }  
    });  
    colonneDate.setGroupTitleRenderer(new GroupTitleRenderer() {

        @Override
        public String getGroupTitle(Object groupValue, GroupNode groupNode,
                ListGridField field, String fieldName, ListGrid grid) {
            final int groupType = (Integer) groupValue;
             String baseTitle ="";

            switch (groupType){
            case groupActual:
                 baseTitle ="Actual Projects";
                break;
            case groupClosed:
                  baseTitle ="Closed Projects";
                break;

            }           
            return baseTitle;
        }             
    });  


listeGridProjets.setGroupByField("date");

【问题讨论】:

标签: sorting smartgwt


【解决方案1】:

我认为您可以像这样在您的colonneDate 上对您的ListGrid 进行排序:

SortSpecifier sortSpecifier = new SortSpecifier("colonneDateFieldName", SortDirection.ASCENDING);
SortSpecifier[] sortSpecifiers = { sortSpecifier };
setSort(sortSpecifiers);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-07
    • 1970-01-01
    • 2012-05-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多