Author: hansbak
Date: Tue Sep 29 07:42:20 2009 New Revision: 819849 URL: http://svn.apache.org/viewvc?rev=819849&view=rev Log: add a sequence number to links if a form is iterated in an iterate section Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=819849&r1=819848&r2=819849&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Tue Sep 29 07:42:20 2009 @@ -267,13 +267,16 @@ 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(); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java?rev=819849&r1=819848&r2=819849&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java Tue Sep 29 07:42:20 2009 @@ -128,6 +128,7 @@ int rowCount = 0; Iterator iter = theList.iterator(); int itemIndex = -1; + int iterateIndex = 0; while (iter.hasNext()) { itemIndex++; if (itemIndex >= highIndex) { @@ -138,13 +139,17 @@ 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); |
Free forum by Nabble | Edit this page |