Hi there,
I'm on latest nightly build of evaluation SmartGWT EE, and I'm testing TreeGrid functionalities.
This is my TreeGrid code:
My TreeGrid is bound to DataSource and all CRUD operation are implemented and working.
At loading, my pane shows only "root" nodes loaded from database (correct). When I expand them, via "fetch" DMI method I retrieve sub-structures, and show. The problem is that the "expand\collapse icon [+]" appears even if the node is a "leaf" and not a "folder". I saw same thing into Showcase demo application. Is there any way to avoid this?
This is my fetch(...) method:
Thanks for support.
Luca.
I'm on latest nightly build of evaluation SmartGWT EE, and I'm testing TreeGrid functionalities.
This is my TreeGrid code:
Code:
Tree tree = new Tree();
tree.setModelType(TreeModelType.PARENT);
kioskGroupTreeGrid = new TreeGrid();
kioskGroupTreeGrid.setData(tree);
kioskGroupTreeGrid.setDataSource(DTPDataSourceManager.getDatasource(DTPDataSourceType.KIOSK_GROUP_DS));
kioskGroupTreeGrid.setHeight100();
kioskGroupTreeGrid.setShowHeader(false);
kioskGroupTreeGrid.setLeaveScrollbarGap(false);
kioskGroupTreeGrid.setAnimateFolders(true);
kioskGroupTreeGrid.setCanAcceptDroppedRecords(true);
kioskGroupTreeGrid.setCanReparentNodes(true);
kioskGroupTreeGrid.setSortField("name");
kioskGroupTreeGrid.setCanEdit(true);
kioskGroupTreeGrid.setSelectionType(SelectionStyle.SINGLE);
kioskGroupTreeGrid.setShowConnectors(true);
kioskGroupTreeGrid.setShowFullConnectors(true);
kioskGroupTreeGrid.setGridComponents((new Object[] { ListGridComponent.HEADER, ListGridComponent.FILTER_EDITOR, ListGridComponent.BODY, getKioskGroupTreeGridToolStrip() }));
kioskGroupTreeGrid.setAutoFetchData(true);
TreeGridField fieldName = new TreeGridField("name");
kioskGroupTreeGrid.setFields(fieldName);
addMember(kioskGroupTreeGrid);
At loading, my pane shows only "root" nodes loaded from database (correct). When I expand them, via "fetch" DMI method I retrieve sub-structures, and show. The problem is that the "expand\collapse icon [+]" appears even if the node is a "leaf" and not a "folder". I saw same thing into Showcase demo application. Is there any way to avoid this?
This is my fetch(...) method:
Code:
public DSResponse fetch(DSRequest dsRequest) throws Exception {
DSResponse dsResponse = new DSResponse();
Long parentId = null;
if (dsRequest.getFieldValue("parentId") instanceof String) {
parentId = Long.parseLong((String) dsRequest.getFieldValue("parentId"));
} else {
parentId = (Long) dsRequest.getFieldValue("parentId");
}
Session hibernateSession = sessionFactory.getCurrentSession();
List<KioskGroup> kioskGroupList = hibernateSession.getNamedQuery("KioskGroup.fetchByParentId").setLong("parentId", parentId).list();
log.info("FETCH " + kioskGroupList.size() + " KioskGroup record");
dsResponse.setData(kioskGroupList);
return dsResponse;
}
Luca.
Comment