Hello there,
I am trying to get the data for my Listgrid from the java class instead from the Datasource field. But I get this exception
My java code is like so
and my datasource is
I am trying to get the data for my Listgrid from the java class instead from the Datasource field. But I get this exception
Code:
10:48:49.274 [ERROR] [kaizenbehsa] Uncaught exception escaped
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at com.smartgwt.client.util.JSOHelper.convertMapToJavascriptObject(JSOHelper.java:1309)
at com.smartgwt.client.util.JSOHelper.convertMapToJavascriptObject(JSOHelper.java:1302)
at com.smartgwt.client.util.JSOHelper.setAttribute(JSOHelper.java:1297)
at com.smartgwt.client.core.DataClass.setAttribute(DataClass.java:311)
at com.smartgwt.client.widgets.grid.ListGridField.setValueMap(ListGridField.java:3924)
at com.behsa.client.view.datamanagement.menu.ProductionLineView.initLayout(ProductionLineView.java:42)
at com.behsa.client.view.datamanagement.menu.ProductionLineView.<init>(ProductionLineView.java:28)
at com.behsa.client.view.datamanagement.menu.ProductionLineController.initView(ProductionLineController.java:22)
Code:
DataSource ds = DataSource.get("productionlineDS");
listgrid = new MyListGrid();
listgrid.setDataSource(ds);
ListGridField name = new ListGridField("name");
ListGridField bize = new ListGridField("bize");
ListGridField pu = new ListGridField("pu");
pu.setValueMap(CommonUtil.unitComboValueMap);
ListGridField ways = new ListGridField("ways");
listgrid.setFields(name,bize,pu,ways);
Code:
public static final LinkedHashMap<Integer, String> unitComboValueMap = new LinkedHashMap<Integer, String>();
static{
unitComboValueMap.put(0,"Gram");
unitComboValueMap.put(1, "Liter");
unitComboValueMap.put(3,"Pcs");
unitComboValueMap.put(4, "Other");
}
Code:
<DataSource ID="productionlineDS" serverType="sql" tableName="proine">
<fields>
<field name="id" type="sequence" hidden="true" primaryKey="true" />
<field name="name" type="ntext" required="true"/>
<field name="bize" type="integer" required="true"/>
<field name="pu" type="integer" required="true"/>
<field name="ways" type="integer" required="true"/>
</fields>
</DataSource>
Comment