-
25 Apr 2012 3:33 AM #1
Row Editing displays toString of edited object
Row Editing displays toString of edited object
Required Information
Version(s) of Ext GWT
GXT 3.0.0 RC2
Browser versions and OS (and desktop environment, if applicable)- IE8, Windows XP
- Chrome 17.0.963.79 m, Windows XP
No
Description
When editing a row, the value of toString, called for the edited object, is displayed.
Run mode
development mode
production mode
Steps to reproduce the problem- Start running in development mode in Eclipse
- Open app in browser
- Click Add button to add entries to table
- Double click on Headline column of value row
Display of editable end not editable values of entry.
Actual result
Prints toString of edited object over editor.
Test case
Grid creation:
Domain TypeCode:@UiFactory Grid<?> createGrid() { IdentityValueProvider<ForumEntry> identity; ColumnConfig<ForumEntry, Date> postedColumn; ColumnConfig<ForumEntry, String> headlineColumn; ColumnConfig<ForumEntry, EntryType> typeColumn; List<ColumnConfig<ForumEntry, ?>> columnList; ColumnModel<ForumEntry> columnModel; ListStore<ForumEntry> listStore; GridEditing<ForumEntry> editing; Grid<ForumEntry> grid; final TextField headlineEditField; identity = new IdentityValueProvider<ForumEntry>(); selectionModel = new CheckBoxSelectionModel<ForumEntry>(identity); postedColumn = new ColumnConfig<ForumEntry, Date>( FORUM_ENTRY_PROPERTIES.creationDate(), 200, "Posted"); typeColumn = new ColumnConfig<ForumEntry, EntryType>( FORUM_ENTRY_PROPERTIES.type(), 200, "Type"); headlineColumn = new ColumnConfig<ForumEntry, String>( FORUM_ENTRY_PROPERTIES.headline(), 200, "Headline"); columnList = new ArrayList<ColumnConfig<ForumEntry, ?>>(); columnList.add(selectionModel.getColumn()); columnList.add(postedColumn); columnList.add(typeColumn); columnList.add(headlineColumn); columnModel = new ColumnModel<ForumEntry>(columnList); listStore = new ListStore<ForumEntry>(FORUM_ENTRY_PROPERTIES.id()); grid = new Grid<ForumEntry>(listStore, columnModel); editing = new GridRowEditing<ForumEntry>(grid); headlineEditField = new TextField(); headlineEditField.addValidator(new Validator<String>() { @Override public List<EditorError> validate(Editor<String> editor, String value) { if (!"Valid".equals(value)) { List<EditorError> errors; errors = new ArrayList<EditorError>(); errors.add(new DefaultEditorError(headlineEditField, "Not Valid", value)); return errors; } return null; } }); headlineEditField.setAutoValidate(true); editing.addEditor(headlineColumn, headlineEditField); grid.getView().setAutoExpandColumn(headlineColumn); grid.getView().setAutoFill(true); grid.setSelectionModel(selectionModel); return grid; }
Property AccessCode:public class ForumEntry { private static int nextId; private int id; private EntryType type; private Date creationDate; private String headline; private String content; public ForumEntry(EntryType type, String headline, String content) { super(); this.id = nextId++; this.type = type; this.headline = headline; this.content = content; this.creationDate = new Date(); } public EntryType getType() { return type; } public void setType(EntryType type) { this.type = type; } public String getHeadline() { return headline; } public void setHeadline(String headline) { this.headline = headline; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public int getId() { return id; } public void setId(int id) { this.id = id; } public Date getCreationDate() { return creationDate; } }
Helpful InformationCode:interface ForumEntryProperties extends PropertyAccess<ForumEntry> { @Path("id") ModelKeyProvider<ForumEntry> id(); @Path("creationDate") ValueProvider<ForumEntry, Date> creationDate(); @Path("type") ValueProvider<ForumEntry, EntryType> type(); @Path("headline") ValueProvider<ForumEntry, String> headline(); }
Screenshot or video
screenshot1.png
Live test- not available; would have attached eclipse project, size too big for attachment.
Debugging already done- «none»
«Not provided»Last edited by FEAT; 25 Apr 2012 at 3:45 AM. Reason: tested in production mode.
-
25 Apr 2012 3:04 PM #2
I find that I'm not able to run your example. Among other things, FORUM_ENTRY_PROPERTIES and EntryType are missing. If you could strip down your test case but still have it implement EntryPoint, I should be able to look into your problem further.
At the moment, I'm seeing no problems with the nightly build of the Explorer Demo at http://staging.sencha.com:8080/examp...oweditablegrid.
-
26 Apr 2012 1:34 AM #3
Reproduction of Bug
Reproduction of Bug
...here come the sources. I have stripped down the project to just the necessary source files. Hope, this is enough.
I think the problem only occurs, when you use a CheckBox column for selection as the first column.
-
22 Dec 2012 9:14 AM #4
Is there any update on this? I am also running into the same issue. The reason for the issue is that GridRowEditing is use in conjunction with the CheckBoxSelection model which contributes its own ColumnConfig to the grid. That column config somehow, when rendered in the row editor, puts out the object ID of the entry (I guess produced by a toString()) call.
It would be great to either get a fix or have a workaround.
Thanks!
Oleg Cohen
-
22 Dec 2012 9:31 AM #5
Well, I actually found a workaround ....
Define a checkbox field:
CheckBox checkBox = new CheckBox();
checkBox.setReadOnly(false);
checkBox.setEnabled(false);
Add editor for the selection model column using a model to Boolean converter.
...
final GridRowEditing<ModelObjectType> gridRowEditing = new GridRowEditing<ModelObjectType>(grid);
...
gridRowEditing.addEditor(sm.getColumn(), new Converter<ModelObjectType, Boolean>() {
@Override
public ModelObjectType convertFieldValue(Boolean object) {
returnnull;
}
@Override
public Boolean convertModelValue(ModelObjectType object) {
return Boolean.FALSE;
}
}, checkBox);
I guess it is not perfect, but when a row editor shows up in the checkbox selection model there will be a disabled checkbox.
Thanks,
Oleg Cohen
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote