PDA

View Full Version : Slider inside editor Grid



mattjcurry
20 Apr 2011, 10:26 AM
Hello,

I am running GXT 2.2.1. I have put a number slider in an editor grid (see code below). The first time I change the slider, everything appears to work ok.

However, after that if I click the cell again, I get the following exception:
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at com.extjs.gxt.ui.client.widget.form.SliderField.setValue(SliderField.java:1)
at com.extjs.gxt.ui.client.widget.Editor.startEdit(Editor.java:425)
at com.extjs.gxt.ui.client.widget.grid.EditorSupport.deferStartEditing(EditorSupport.java:200)
at com.extjs.gxt.ui.client.widget.grid.EditorSupport$2.execute(EditorSupport.java:139)
at com.google.gwt.user.client.CommandExecutor.doExecuteCommands(CommandExecutor.java:310)


services = new ArrayList<BaseModel>();
serviceColConfig = new ColumnConfig("service", "Service", 10);

growthColConfig = new ColumnConfig("growth", "Growth", 30);

Slider slider = new Slider();
slider.setMinValue(0);
slider.setMaxValue(100);
slider.setIncrement(2);
SliderField sf = new SliderField(slider);
sf.setInEditor(true);
sf.setMessageTarget("tooltip");
sf.setFieldLabel("Growth");

CellEditor sliderEditor = new CellEditor(sf);
growthColConfig.setEditor(sliderEditor);


List<ColumnConfig> cols = new ArrayList<ColumnConfig>();
cols.add(serviceColConfig);
cols.add(growthColConfig);

ColumnModel cm = new ColumnModel(cols);
store = new ListStore<BaseModel>();
store.add(services);

grid = new EditorGrid<BaseModel>(store, cm);