I'd like to use the override of createRecordComponent on a ListGrid to embed a DynamicForm in one of the columns. The form shows up, but the row height is still the standard height so you can't see the complete form, even though I've setFixedRecordHeights(false). I'd like the row height to auto fit to the form height since not every row will have the exact same form.
Announcement
Collapse
No announcement yet.
X
-
The sample uses getExpansionComponent which is the technique I've switched over to and I think will ultimately make for a better solution anyway.
I was originally trying to override createRecordComponent and have the form show up in a cell of the main ListGrid row instead of having a separate expansion section. I still may want to try that on another screen so it would be nice to know if it is possible, or is createRecordComponent expected to return a Canvas that will fit in the predetermined row height?
Comment
-
here is the example that demonstrates the problem:
Code:public void onModuleLoad() { TreeGrid grid = new TreeGrid(){ @Override protected Canvas createRecordComponent(ListGridRecord record, Integer colNum) { String fieldName = getFieldName(colNum); if (fieldName.startsWith("c")) { Label label = new Label("CANVAS"); label.setWidth100(); label.setHeight(100); label.setBorder("2px solid blue"); return label; } else { return null; } } }; ArrayList<TreeGridField> fields = new ArrayList<TreeGridField>(); fields.add(new TreeGridField("label", "Label")); for (int i=0; i<2; i++) { fields.add(new TreeGridField("c"+i, "COL "+i)); } grid.setShowRecordComponents(true); grid.setShowRecordComponentsByCell(true); grid.setFields(fields.toArray(new ListGridField[fields.size()])); grid.setWidth(600); grid.setFixedRecordHeights(false); Tree tree = new Tree(); tree.setModelType(TreeModelType.PARENT); tree.setNameProperty("label"); tree.setIdField("id"); tree.setParentIdField("parentId"); tree.setRootValue(0); grid.setShowRoot(false); grid.setData(tree); TreeNode rootNode = grid.getTree().getRoot(); tree.add(createNode("label1", 1, 0), rootNode); tree.add(createNode("label2", 2, 0), rootNode); grid.setHeight100(); grid.draw(); } public TreeNode createNode(String label, int id, int parentId) { TreeNode node = new TreeNode(); node.setAttribute("label", label); node.setAttribute("id", id); node.setAttribute("parentId", parentId); return node; } }
The code produces the layout as the attached screenshot. You can notice that blue boxes overlap, but they should not, i.e. row height should expand to accommodate the box height.
Same happens if I try with ListGrid instead of TreeGrid.
Am I doing something wrong?
Best,
PredragLast edited by pedjak; 22 Jun 2010, 17:55.
Comment
Comment