/* * Isomorphic SmartGWT web presentation layer * Copyright 2000 and beyond Isomorphic Software, Inc. * * OWNERSHIP NOTICE * Isomorphic Software owns and reserves all rights not expressly granted in this source code, * including all intellectual property rights to the structure, sequence, and format of this code * and to all designs, interfaces, algorithms, schema, protocols, and inventions expressed herein. * * If you have any questions, please email
. * * This entire comment must accompany any portion of Isomorphic Software source code that is * copied or moved from this file. */ package com.smartgwt.sample.showcase.client.dataintegration.java.grid; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.types.ListGridEditEvent; 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.PanelFactory; import com.smartgwt.sample.showcase.client.ShowcasePanel; public class LiveGridFetchSample implements EntryPoint { public void onModuleLoad() { DataSource dataSource = DataSource.get("supplyItem"); ListGridField rowNum = new ListGridField("rowNum"); rowNum.setWidth(70); 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.setCanEdit(true); listGrid.setWidth100(); listGrid.setHeight100(); listGrid.setCanEdit(true); listGrid.setAutoFetchData(true); listGrid.setDataSource(dataSource); listGrid.setEditEvent(ListGridEditEvent.DOUBLECLICK); listGrid.setModalEditing(true); listGrid.setFields(rowNum, itemName, sku, description, category, units, unitCost); listGrid.draw(); } }