Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    -1
    fother is an unknown quantity at this point

      0  

    Default [CLOSED] AggregationRowConfig with RPC return null pointer

    [CLOSED] AggregationRowConfig with RPC return null pointer


    set the class Customer to
    Code:
    public class Customer implements BeanModelTag, Serializable {
    change the code in BeanModelGridExample to
    Code:
    public class BeanModelGridExample extends LayoutContainer {
    
    	@Override
    	protected void onRender(Element parent, int index) {
    		super.onRender(parent, index);
    		setStyleAttribute("padding", "20px");
    
    		GridCellRenderer<BeanModel> render = new GridCellRenderer<BeanModel>() {
    
    			public Object render(BeanModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<BeanModel> store,
    					Grid<BeanModel> grid) {
    				return "test " + model.get("age");
    			}
    
    		};
    
    		// gwt service
    		final ExampleServiceAsync service = (ExampleServiceAsync) Registry.get(Examples.SERVICE);
    
    		// proxy and reader
    		RpcProxy<List<Customer>> proxy = new RpcProxy<List<Customer>>() {
    			@Override
    			public void load(Object loadConfig, AsyncCallback<List<Customer>> callback) {
    				service.getCustomers(callback);
    			}
    		};
    		BeanModelReader reader = new BeanModelReader();
    
    		// loader and store
    		ListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(proxy, reader);
    		ListStore<BeanModel> store = new ListStore<BeanModel>(loader);
    
    		loader.load();
    
    		// column model
    		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    		columns.add(new ColumnConfig("name", "Name", 200));
    		columns.add(new ColumnConfig("email", "Email", 100));
    
    		ColumnConfig age = new ColumnConfig("age", "Age", 50);
    		age.setRenderer(render);
    
    		columns.add(age);
    
    		AggregationRowConfig<BeanModel> totals = new AggregationRowConfig<BeanModel>();
    
    		totals.setSummaryType("age", SummaryType.AVG);
    		totals.setRenderer("age", new AggregationRenderer<BeanModel>() {
    
    			public Object render(Number value, int colIndex, Grid<BeanModel> grid, ListStore<BeanModel> store) {
    				return NumberFormat.getCurrencyFormat().format(value.doubleValue());
    			}
    		});
    
    		ColumnModel cm = new ColumnModel(columns);
    		cm.addAggregationRow(totals);
    
    		Grid<BeanModel> grid = new Grid<BeanModel>(store, cm);
    		grid.setAutoExpandColumn("name");
    		grid.setSize(400, 200);
    
    		add(grid);
    	}
    on method getCustomers() of the class ExampleServiceImpl, add one break point in
    Code:
    return customers;
    DEBUG the GXT explorer demo application and click to see the BeanModelGrid example.. you will see that the grid will render.. and return a null pointer exception.. so.. click in button Resume(F8) the data will render and the aggregation row will appears correctely..

    Real situation.. when call a remote procedure.. can be a complex calc and delay more than the normal..

    I believe that the behavior of the aggregation row should be like GridCellRenderer

  2. #2
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    -1
    fother is an unknown quantity at this point

      0  

    Default


    in ColumnFooter you need verify in the line 228

    add this condition

    Code:
    if (value != null) {
      Object obj = renderer.render(value, j, (Grid) grid, (ListStore) store);
    }

  3. #3
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    -1
    fother is an unknown quantity at this point

      0  

    Default


    other real situation.. the RPC need access other database.. that delay more than normal..

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    The issue is in your renderer and not GXT. I close this issue.

  5. #5
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    -1
    fother is an unknown quantity at this point

      0  

    Default


    no!

    to solve this I always need add this condition in my code..

    Code:
    		totals.setRenderer("age", new AggregationRenderer<BeanModel>() {
    
    			public Object render(Number value, int colIndex, Grid<BeanModel> grid, ListStore<BeanModel> store) {
    				
    				if (value != null) {
    					return NumberFormat.getCurrencyFormat().format(value.doubleValue());
    				} else {
    					return "";
    				}
    			}
    		});

  6. #6
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    yes and that is correct. If value is null you cant call doubleValue on it.

  7. #7
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    -1
    fother is an unknown quantity at this point

      0  

    Default


    yes I know about this

    the problem that this method is called twice.. when the grid is render.. that the value is null and when the data its load.. I believe that if the value is null, cannot call the method render.. because in all situation will return null pointer..

  8. #8
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Also that is correct. The footer should also be displayed with 0 records in the grid.

  9. #9
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744
    Vote Rating
    -1
    fother is an unknown quantity at this point

      0  

    Default


    I agree with you.. but only the html and widget can be render when have 0 records..

    the method render no can.. because what the value for average sum and other when dont have records?

  10. #10
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    That is why you define a renderer. So you can say what should be displayed in that case.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi