1. #1
    Ext User
    Join Date
    Oct 2008
    Posts
    4
    Vote Rating
    0
    Mike Lee is on a distinguished road

      0  

    Default Grouping Grid - Group Name does not show up

    Grouping Grid - Group Name does not show up


    Hi all
    When GroupingGrid is grouped by some columns which is using GridCellRender, the group name will not properly show up.

    In my case, i use BeanModel containing a Date field. And i want it to group by Month. So i add a column with GridCellRender to obtain Month column from Date field. But the GroupName does not show up. And i find that it applies to all other fields with GridCellRender.

    Do you have suggestion/workaround to make this work

    Using gxt-1.1 official release

    Thanks
    Mike Lee

  2. #2
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Default


    post some code showing how you are configuring the grid...

    I'm using Grid and BeanModel and had to ensure the group renderer returned a string

    Code:
    view.setGroupRenderer(new GridGroupRenderer() {
      public String render(GroupColumnData data) {
        return ((Category) ((BeanModel) data.gvalue).getBean()).getName();
        }
      });

  3. #3
    Ext User
    Join Date
    Oct 2008
    Posts
    4
    Vote Rating
    0
    Mike Lee is on a distinguished road

      0  

    Default


    Actually, i have tried this method. And found that gvalue come with null instead of the data from the column.

  4. #4
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Default


    post some code

    grant

  5. #5
    Ext User
    Join Date
    Oct 2008
    Posts
    4
    Vote Rating
    0
    Mike Lee is on a distinguished road

      0  

    Default


    In the end of code segment, this print out "data.gvalue : null"

    Code:
            // Month Column
            SummaryColumnConfig month = new SummaryColumnConfig("month", "Month", 80);
            month.setRenderer(new GridCellRenderer<BeanModel>() {
                public String render(BeanModel model, String property,
                        ColumnData config, int rowIndex, int colIndex,
                        ListStore<BeanModel> store) {
                    Transaction tran = (Transaction) model.getBean();
                    model.set("month", DateTimeFormat.getFormat("MMMM").format(tran.getDate()));
                    return DateTimeFormat.getFormat("MMMM").format(tran.getDate());
                }
            });
    
            // Create Grid
            EditorGrid<BeanModel> grid = new EditorGrid<BeanModel>(store, cm);
            grid.setBorders(true);
            GroupSummaryView summary = new GroupSummaryView();
            summary.setForceFit(true);
            summary.setShowGroupedColumn(false);
            summary.setEnableGroupingMenu(true);
            grid.setView(summary);
            grid.getView().setShowDirtyCells(false);
            summary.setGroupRenderer(new GridGroupRenderer() {
                public String render(GroupColumnData data) {
                    System.out.println("data.gvalue : " + data.gvalue);
                    return data.field;
                }
                
            });

  6. #6
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Default


    How is the store being groupby ?

    You'll need to post some more code. I've got a grid, using beanmodel and grouping with a summarycolumn etc.. all working fine.

    Obviously something is wrong with how you are implementing yours. Can't help unless I see more code/complete code.

    cheers,
    grant

  7. #7
    Ext User
    Join Date
    Oct 2008
    Posts
    4
    Vote Rating
    0
    Mike Lee is on a distinguished road

      0  

    Default


    I am sorry, i just think that is straight forward. Here are the codes.

    Thx

    Code:
            // proxy and reader
            proxy = new RpcProxy() {
                @Override
                public void load(Object loadConfig, AsyncCallback callback) {
                    accountService.getTransactions(callback);
                }
            };
            BeanModelReader reader = new BeanModelReader();
            // loader and store
            loader = new BaseListLoader(proxy, reader);        
            // Set Group Store
            store = new GroupingStore<BeanModel>(loader);
            store.groupBy("month");
    
    
    
            // Month Column
            SummaryColumnConfig month = new SummaryColumnConfig("month", "Month", 80);
            month.setRenderer(new GridCellRenderer<BeanModel>() {
                public String render(BeanModel model, String property,
                        ColumnData config, int rowIndex, int colIndex,
                        ListStore<BeanModel> store) {
                    Transaction tran = (Transaction) model.getBean();
                    model.set("month", DateTimeFormat.getFormat("MMMM").format(tran.getDate()));
                    return DateTimeFormat.getFormat("MMMM").format(tran.getDate());
                }
            });
    
            // Column effect
            List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
            columns.add(month);
            ColumnModel cm = new ColumnModel(columns);
    
            // Create Grid
            EditorGrid<BeanModel> grid = new EditorGrid<BeanModel>(store, cm);
            grid.setBorders(true);
            GroupSummaryView summary = new GroupSummaryView();
            summary.setForceFit(true);
            summary.setShowGroupedColumn(false);
            summary.setEnableGroupingMenu(true);
            grid.setView(summary);
            grid.getView().setShowDirtyCells(false);

Thread Participants: 1