Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

creatRecordComponent Not Invoking

$
0
0
I Used SmartGwt4.0 LGPL Version.

Code:


import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;

public class ViewChart extends Composite{

        private static ViewChartUiBinder uiBinder = GWT
                        .create(ViewChartUiBinder.class);

        interface ViewChartUiBinder extends UiBinder<Widget, ViewChart> {
        }

        @UiField HTMLPanel ht;

       

       
        public ViewChart() {
                initWidget(uiBinder.createAndBindUi(this));
                ListGrid grid = getLGrid();
               
                ht.add(grid);
        }
       
        private ListGrid getLGrid() {
                final ListGrid Lgrid = new ListGrid(){
                        @Override
                        protected Canvas createRecordComponent(ListGridRecord record,
                                        Integer colNum) {
                                // TODO Auto-generated method stub
                                System.out.println("Invoking...");
                                return super.createRecordComponent(record, colNum);
                        }
                };
                Lgrid.refreshFields();
                Lgrid.setSize("250px", "250px");
                Lgrid.setSortField("first");
               
                Lgrid.setFields(getListGridFields());
                Lgrid.setRecords(getListGridRecords());
                return Lgrid;
        }

        private ListGridRecord[] getListGridRecords() {
                ListGridRecord[] records=new ListGridRecord[10];
                for (int i = 0; i < records.length; i++) {
                        ListGridRecord rec=new ListGridRecord();
                        rec.setAttribute("first", "First "+(i+1));
                        rec.setAttribute("sec", "Second "+(i+1));
                        records[i]=rec;
                }
                return records;
        }

        private ListGridField[] getListGridFields() {
                ListGridField[] fields=new ListGridField[2];
                ListGridField lf1=new ListGridField("first","First");
                fields[0]=lf1;
                ListGridField lf2=new ListGridField("sec","Second");
                fields[1]=lf2;
                return fields;
        }

       
}

I Created Listgrid its shown but createRecordComponent is not invoking..
Here i attached my output.Please do needful for how can i invoke createRecordComponent.

Thanks in Advance.

Attached Images
File Type: jpg Capture.JPG (19.9 KB)

Viewing all articles
Browse latest Browse all 4756

Trending Articles