Hi Isomorphic,
I have modified the Drag Reparent showcase sample to add a record component to the tree field.
The record components are initially indented properly, however, if you reparent an item, the record component indentation does not change.
Thanks
I have modified the Drag Reparent showcase sample to add a record component to the tree field.
Code:
public void onModuleLoad() { Tree employeeTree = new Tree(); employeeTree.setModelType(TreeModelType.PARENT); employeeTree.setRootValue(1); employeeTree.setNameProperty("Name"); employeeTree.setIdField("EmployeeId"); employeeTree.setParentIdField("ReportsTo"); employeeTree.setOpenProperty("isOpen"); employeeTree.setData(employeeData); TreeGridField formattedField = new TreeGridField("Name"); TreeGrid employeeTreeGrid = new TreeGrid() { @Override protected Canvas createRecordComponent(ListGridRecord record, Integer colNum) { String fieldName = this.getFieldName(colNum); if ("Name".equals(fieldName)) { String name = record.getAttribute("Name"); IButton button = new IButton(); button.setTitle(name); button.addClickHandler(event -> SC.say(record.getAttributeAsString("Job"))); return button; } return null; }; }; employeeTreeGrid.setWidth(500); employeeTreeGrid.setHeight(400); employeeTreeGrid.setNodeIcon("icons/16/person.png"); employeeTreeGrid.setFolderIcon("icons/16/person.png"); employeeTreeGrid.setAutoFetchData(true); employeeTreeGrid.setCanReorderRecords(true); employeeTreeGrid.setCanAcceptDroppedRecords(true); employeeTreeGrid.setShowOpenIcons(false); employeeTreeGrid.setDropIconSuffix("into"); employeeTreeGrid.setClosedIconSuffix(""); employeeTreeGrid.setData(employeeTree); employeeTreeGrid.setFields(formattedField); employeeTreeGrid.setShowSelectedIcons(true); employeeTreeGrid.setShowRecordComponents(true); employeeTreeGrid.setShowRecordComponentsByCell(Boolean.TRUE); employeeTreeGrid.setIndentRecordComponents(true); employeeTreeGrid.setRecordComponentPosition(EmbeddedPosition.WITHIN); employeeTreeGrid.draw(); }
Thanks
Comment