Hi Isomorphic,
please see this BuiltInDS based testcase (using v10.1p_2017-08-20), similar to this sample, but without constant height for the recordComponents. My problems are:
Best regards
Blama
please see this BuiltInDS based testcase (using v10.1p_2017-08-20), similar to this sample, but without constant height for the recordComponents. My problems are:
- Row height. As the RecordComponent height can differ, the ListGrid row heigth should also differ. This happens, but does not match the needed height. It just looks strange and somehow shifted.
- For me, the sample is showing a short horizontal scrollbar (tested with FF26 Dev mode, see screenshot). I can't scroll to the right, it always jumps back to the left.
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.Random; import com.smartgwt.client.Version; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.Overflow; import com.smartgwt.client.types.RecordComponentPoolingMode; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS extends VLayout implements EntryPoint { private IButton recreateBtn; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); setWidth100(); setHeight100(); recreateBtn = new IButton("Recreate"); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { new MyWindow().show(); } }); addMember(recreateBtn); new MyWindow().show(); draw(); } private class MyWindow extends Window { public MyWindow() { setWidth("95%"); setHeight("95%"); setMembersMargin(0); setModalMaskOpacity(70); setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); setTitle("RecordComponent height and horizontal scroll problem" + getTitle()); setShowMinimizeButton(false); setIsModal(true); setShowModalMask(true); centerInPage(); ListGrid messengerTest = new MessengerTest(); addItem(messengerTest); } } private class MessengerTest extends ListGrid { private final String FAKECOLUMNNAME = "FAKECOLUMN"; protected Label myLabel; public MessengerTest() { super(DataSource.get("animals")); setVirtualScrolling(false); setShowRecordComponents(true); setShowRecordComponentsByCell(true); setRecordComponentPoolingMode(RecordComponentPoolingMode.RECYCLE); setPoolComponentsPerColumn(true); setWidth(1000); setHeight(500); ListGridField fakecolumnLGF = new ListGridField(FAKECOLUMNNAME); fakecolumnLGF.setShowTitle(false); ListGridField commonNameLGF = new ListGridField("commonName"); commonNameLGF.setWidth(100); setFields(commonNameLGF, fakecolumnLGF); setSortField("commonName"); fetchData(); } @Override protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) { return updateRecordComponent(record, colNum, null, true); } public Canvas updateRecordComponent(ListGridRecord record, Integer colNum, Canvas component, boolean recordChanged) { String fieldName = this.getFieldName(colNum); if (FAKECOLUMNNAME.equals(fieldName)) { // String s = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr."; String text = record.getAttributeAsString("information"); int labelType = Random.nextInt(2); myLabel = new Label(text); myLabel.setWidth(200); myLabel.setHeight(1); myLabel.setOverflow(Overflow.VISIBLE); HLayout myLayout = new HLayout(); switch (labelType) { case 0: // myLabel.setStyleName("chatterLabelBlue"); myLayout.setAlign(Alignment.RIGHT); break; case 1: // myLabel.setStyleName("chatterLabelGray"); myLayout.setAlign(Alignment.LEFT); break; } myLayout.setWidth(900); myLayout.addMember(myLabel); return myLayout; } else return null; } } }
Blama
Comment