import com.smartgwt.client.widgets.layout.VLayout; 
import com.smartgwt.client.data.Criterion;  
import com.smartgwt.client.data.DateRange;  
import com.smartgwt.client.data.RelativeDate;  
import com.smartgwt.client.types.TitleOrientation;  
import com.smartgwt.client.util.SC;  
import com.smartgwt.client.widgets.Canvas;  
import com.smartgwt.client.widgets.IButton;  
import com.smartgwt.client.widgets.Label;  
import com.smartgwt.client.widgets.events.ClickEvent;  
import com.smartgwt.client.widgets.events.ClickHandler;  
import com.smartgwt.client.widgets.events.DrawEvent;  
import com.smartgwt.client.widgets.events.DrawHandler;  
import com.smartgwt.client.widgets.form.DynamicForm;  
import com.smartgwt.client.widgets.form.fields.ButtonItem;  
import com.smartgwt.client.widgets.form.fields.DateRangeItem;  
import com.smartgwt.client.widgets.grid.ListGrid;  
import com.smartgwt.client.widgets.layout.VLayout; 
import com.smartgwt.client.data.DataSource;  
import com.smartgwt.client.data.fields.*; 

public class GridDateRangeFilterSample implements EntryPoint {  

    public void onModuleLoad() {  
        VLayout layout = new VLayout(8);  
        layout.setHeight100();  
        layout.setWidth100();  
        layout.setMembersMargin(10);  
	
	DataSource ds = new DataSource();
	
	ds.setID("testDateTimeDS");
	
	DataSourceField idField = new DataSourceTextField("id");
	idField.setPrimaryKey(Boolean.TRUE);

	DataSourceField createdField = new DataSourceDateTimeField("timestamp");
	createdField.setType(FieldType.DATETIME);

	ds.setFields(idField, createdField);
	ds.setRecordXPath("/List/TestRecord"); 
	ds.setDataURL("datetimetest.data.xml");
	ds.setClientOnly(true);

	ListGrid testListGrid = new ListGrid();
	testListGrid.setDataSource(ds);
	testListGrid.setCanEdit(true);
	testListGrid.setShowFilterEditor(true);
	testListGrid.setAutoFetchData(true);
	
	ListGridField id = new ListGridField("Id");
	ListGridField created = new ListGridField("Created");
	MiniDateRangeItem item = new MiniDateRangeItem();
	item.setType("datetime");
	created.setFilterEditorProperties(item);
	
	testListGrid.setFields(id, created);

	layout.setMembers(testListGrid); 
	layout.draw();
}


