private void addParentRow(TTAMedicationAndPharmacyForTTAHistoryVo tta) { if (tta == null) return; DynamicGridRow parent = form.dyngrdTTA().getRows().newRow(); parent.setValue(tta); DynamicGridCell newCell = parent.getCells().newCell(getGridColumn(NAME_IDENTIFIER), DynamicCellType.HTMLVIEW); newCell.setValue("<B>Created:</b> " + (tta.getSystemInfoIsNotNull() ? tta.getSystemInfo().getCreationDateTime() : "N/A") + " <B>By: </B>" + (tta.getOrderingClinicianIsNotNull() ? tta.getOrderingClinician().getIMosName() : "N/A")); newCell.setReadOnly(true); newCell = parent.getCells().newCell(getGridColumn(SELECT_IDENTIFIER), DynamicCellType.BOOL); newCell.setReadOnly(false); newCell.setAutoPostBack(true); addChildRows(tta.getTTAMedications(), parent); }
@Override protected void onDyngrdTTACellValueChanged(DynamicGridCell cell) { if (protectCode) return; if (cell.getColumn().getIdentifier().equals(SELECT_IDENTIFIER) && cell.getValue() instanceof Boolean) { boolean value = ((Boolean) cell.getValue()).booleanValue(); // Is parent if (cell.getRow().getValue() instanceof TTAMedicationAndPharmacyForTTAHistoryVo) { markChilds(cell.getRow().getRows(), value); } else { if (!value && cell.getRow().getValue() instanceof TTAMedicationDetailRefVo) { cell.getRow().getParent().getCells().get(getGridColumn(SELECT_IDENTIFIER)).setValue(false); } } } }
private void populateGrid(TTAMedicationAndPharmacyForTTAHistoryVoCollection ttas) { form.dyngrdTTA().getRows().clear(); if (ttas == null || ttas.size() == 0) return; for (int i = 0; i < ttas.size(); i++) { TTAMedicationAndPharmacyForTTAHistoryVo tta = ttas.get(i); if (tta == null) continue; addParentRow(tta); } }