SmartClient Version: v8.3p_2013-01-09/PowerEdition Deployment (built 2013-01-09)
IE 9.0.8112.16421 on Vista in dev mode.
Using <!DOCTYPE html>
In view mode, the Grid looks fine. I've capped the heights of the rows to 50 since I don't wish to see all the long text in the "note" field.
Problem 1) However, on entering edit mode for a row in a list grid, the row size changes unexpectedly when an non-editable field ("note") with lengthy text is also present. The row is trying to display the entire text for the "note" field when it shouldn't. Moreover, the "name" and "description" values move to the centre of the row although they were top aligned in view mode.
This happens even though the row heights are capped at 50 for both the List Grid cell height and the editor form Items. I would think that the row size should not change on entering edit mode even if some fields are non-editable and lengthy. Also, vertical text alignment of the non-editable fields should probably not change when entering edit mode.
If I make the "note" field editable, then the row length problem disappears, although the "name" field does change its alignment from top to center, which it probably shouldn't.
Problem 2) In the case above, the "name" field is not set to frozen. The second problem is that when the "name" field is set to frozen, the problem gets worse (uncomment //fName.setFrozen(true) in the code below for this case).
There are no Javscript errors in the logs.
There are no server-side errors.
Here is the sample code:
Here is the test data source:
Here is the server-side code:
IE 9.0.8112.16421 on Vista in dev mode.
Using <!DOCTYPE html>
In view mode, the Grid looks fine. I've capped the heights of the rows to 50 since I don't wish to see all the long text in the "note" field.
Problem 1) However, on entering edit mode for a row in a list grid, the row size changes unexpectedly when an non-editable field ("note") with lengthy text is also present. The row is trying to display the entire text for the "note" field when it shouldn't. Moreover, the "name" and "description" values move to the centre of the row although they were top aligned in view mode.
This happens even though the row heights are capped at 50 for both the List Grid cell height and the editor form Items. I would think that the row size should not change on entering edit mode even if some fields are non-editable and lengthy. Also, vertical text alignment of the non-editable fields should probably not change when entering edit mode.
If I make the "note" field editable, then the row length problem disappears, although the "name" field does change its alignment from top to center, which it probably shouldn't.
Problem 2) In the case above, the "name" field is not set to frozen. The second problem is that when the "name" field is set to frozen, the problem gets worse (uncomment //fName.setFrozen(true) in the code below for this case).
There are no Javscript errors in the logs.
There are no server-side errors.
Here is the sample code:
Code:
public void onModuleLoad() { testCase(); } private void testCase() { VLayout layout = new VLayout(); final ListGrid g = new ListGrid(); g.setWidth(550); g.setHeight(500); g.setShowAllRecords(true); g.setFixedRecordHeights(true); g.setVirtualScrolling(false); g.setWrapCells(true); g.setCellHeight(50); g.setUseAllDataSourceFields(true); g.setDataSource(DataSource.get("testCase")); ListGridField fName = new ListGridField("name"); fName.setCanEdit(false); //fName.setFrozen(true); ListGridField fDesc = new ListGridField("description"); fDesc.setCanEdit(true); TextAreaItem fDescEditor = new TextAreaItem(); fDescEditor.setHeight(50); fDesc.setEditorType(fDescEditor); ListGridField fNote = new ListGridField("note"); fNote.setCanEdit(false); TextAreaItem fNoteEditor = new TextAreaItem(); fNoteEditor.setHeight(50); fNote.setEditorType(fNoteEditor); g.setFields(fName, fDesc, fNote); g.setAutoFetchData(true); g.setCanEdit(true); g.setEditEvent(ListGridEditEvent.NONE); g.setRowEndEditAction(RowEndEditAction.SAME); g.setAutoSaveEdits(false); IButton editBtn = new IButton("Edit"); editBtn.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { @Override public void onClick(ClickEvent event) { g.startEditing(); } }); IButton saveBtn = new IButton("Save"); saveBtn.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { @Override public void onClick(ClickEvent event) { g.endEditing(); g.saveAllEdits(); } }); layout.addMember(editBtn); layout.addMember(saveBtn); layout.addMember(g); layout.draw(); }
Code:
<?xml version="1.0" encoding="UTF-8"?> <DataSource ID="testCase" serverType="generic"> <fields> <field name="name" type="text" title="Name" primaryKey="true"> </field> <field name="description" type="text" title="Description"> </field> <field name="note" type="text" title="Note"> </field> </fields> <serverObject lookupStyle="new" className="test.sgwt.TestService" /> <operationBindings> <binding operationType="fetch" serverMethod="testFetch"> </binding> <binding operationType="update" serverMethod="testUpdate"> </binding> </operationBindings> </DataSource>
Code:
package test.sgwt; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.isomorphic.datasource.DSRequest; public class TestService { public List testFetch(DSRequest request) { List rows = new ArrayList(); Map row1 = new HashMap(); row1.put("name", "Test Name 1"); row1.put("description", "Test Description 1"); row1.put("note", "Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 " + "Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 " + "Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 " + "Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 " + "Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 " + "Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 " + "Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 " + "Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 " + "Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 " + "Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1 Test Note 1"); //row.put("selectField", new String[] {"value2"}); rows.add(row1); Map row2 = new HashMap(); row2.put("name", "Test Name 2"); row2.put("description", "Test Description 2"); row2.put("note", "Test Note 2 Test Note 2 Test Note 2 Test Note 2 Test Note 2 Test Note 2 Test Note 2 Test Note 2 Test Note 2 " + "Test Note 2 Test Note 2 Test Note 2 Test Note 2 Test Note 2 Test Note 2 Test Note 2 Test Note 2 Test Note 2"); //row.put("selectField", new String[] {"value2"}); rows.add(row2); return rows; } public List testUpdate(DSRequest request) { List rows = new ArrayList(); Map row = new HashMap(); row.put("name", request.getOldValues().get("name")); if (request.getValues().get("description") != null) { row.put("description", request.getValues().get("description")); } else { row.put("description", request.getOldValues().get("description")); } if (request.getValues().get("note") != null) { row.put("note", request.getValues().get("note")); } else { row.put("note", request.getOldValues().get("note")); } rows.add(row); return rows; } }
Comment