/* * SmartGWT (GWT for SmartClient) * Copyright 2008 and beyond, Isomorphic Software, Inc. * * SmartGWT is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 3 * as published by the Free Software Foundation. SmartGWT is also * available under typical commercial license terms - see * http://smartclient.com/license * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.grid.CellFormatter; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord; import com.smartgwt.sample.showcase.client.data.ItemSupplyXmlDS; public class LiveGridFetchSample implements EntryPoint { public void onModuleLoad() { DataSource dataSource = ItemSupplyXmlDS.getInstance(); ListGridField rowNum = new ListGridField("itemNum", "Item No."); rowNum.setWidth(65); rowNum.setCellFormatter(new CellFormatter() { public String format(Object value, ListGridRecord record, int rowNum, int colNum) { return rowNum +""; } }); ListGridField itemName = new ListGridField("itemName", 100); ListGridField sku = new ListGridField("SKU", 100); ListGridField description = new ListGridField("description", 150); ListGridField category = new ListGridField("category", 100); ListGridField units = new ListGridField("units", 100); ListGridField unitCost = new ListGridField("unitCost", 100); unitCost.setType(ListGridFieldType.FLOAT); ListGridField inStock = new ListGridField("inStock", 100); inStock.setType(ListGridFieldType.BOOLEAN); ListGridField nextShipment = new ListGridField("nextShipment", 100); nextShipment.setType(ListGridFieldType.DATE); final ListGrid listGrid = new ListGrid(); listGrid.setWidth100(); listGrid.setHeight100(); listGrid.setAutoFetchData(true); listGrid.setDataSource(dataSource); listGrid.setFields(rowNum, itemName, sku, description, category, units, unitCost, itemName, sku, description, category, units, unitCost, itemName, sku, description, category, units, unitCost); listGrid.draw(); } }