package com.avenue100.ds.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwtpro.tools.client.SCPRO;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Mdg implements EntryPoint {

    /**
     * This is the entry point method.
     */
    public void onModuleLoad() {
        SCPRO.openDataSourceConsole();

        final ListGrid listGrid = new ListGrid();
        listGrid.setWidth(500);
        listGrid.setHeight(224);
        listGrid.setAlternateRecordStyles(true);
        listGrid.setDataSource(DataSource.get("userResponsesDS"));
        listGrid.setFetchOperation("summary");
        
        ListGridField f1 = new ListGridField("form_id", "FormId");
        ListGridField f2 = new ListGridField("type", "Type");
        ListGridField f3 = new ListGridField("status", "Status");
        ListGridField f4 = new ListGridField("created_at", "Created");

        listGrid.setFields(f1,f2,f3,f4);
        listGrid.fetchData();

        VLayout layout = new VLayout(15);
        layout.addMember(listGrid);

        layout.draw();

    }
}

