add a sequence number to links if a form is iterated in an iterate section
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@819849 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -267,13 +267,16 @@ public class WidgetWorker {
|
||||
public static String makeLinkHiddenFormName(Map<String, Object> context, ModelFormField modelFormField) {
|
||||
ModelForm modelForm = modelFormField.getModelForm();
|
||||
Integer itemIndex = (Integer) context.get("itemIndex");
|
||||
String iterateId = "";
|
||||
String formName = (String) context.get("formName");
|
||||
if (UtilValidate.isEmpty(formName)) {
|
||||
formName = modelForm.getName();
|
||||
}
|
||||
|
||||
if (UtilValidate.isNotEmpty(context.get("iterateId"))) {
|
||||
iterateId = (String) context.get("iterateId");
|
||||
}
|
||||
if (itemIndex != null) {
|
||||
return formName + modelForm.getItemIndexSeparator() + itemIndex.intValue() + modelForm.getItemIndexSeparator() + modelFormField.getName();
|
||||
return formName + modelForm.getItemIndexSeparator() + itemIndex.intValue() + iterateId + modelForm.getItemIndexSeparator() + modelFormField.getName();
|
||||
} else {
|
||||
return formName + modelForm.getItemIndexSeparator() + modelFormField.getName();
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ public class IterateSectionWidget extends ModelScreenWidget {
|
||||
int rowCount = 0;
|
||||
Iterator iter = theList.iterator();
|
||||
int itemIndex = -1;
|
||||
int iterateIndex = 0;
|
||||
while (iter.hasNext()) {
|
||||
itemIndex++;
|
||||
if (itemIndex >= highIndex) {
|
||||
@@ -138,13 +139,17 @@ public class IterateSectionWidget extends ModelScreenWidget {
|
||||
continue;
|
||||
}
|
||||
if (isEntrySet) {
|
||||
contextMs.put(entryName, ((Map)item).get("value"));
|
||||
contextMs.put(entryName, ((Map)item).get("value"));
|
||||
contextMs.put(keyName, ((Map)item).get("key"));
|
||||
} else {
|
||||
contextMs.put(entryName, item);
|
||||
}
|
||||
contextMs.put("itemIndex", Integer.valueOf(itemIndex));
|
||||
|
||||
|
||||
if (iterateIndex < listSize) {
|
||||
contextMs.put("iterateId",String.valueOf(entryName+iterateIndex));
|
||||
iterateIndex++;
|
||||
}
|
||||
rowCount++;
|
||||
for (ModelScreenWidget.Section section: this.sectionList) {
|
||||
section.renderWidgetString(writer, contextMs, screenStringRenderer);
|
||||
|
||||
Reference in New Issue
Block a user