OFBIZ-240 - Render a selectAll checkbox for forms of type multi. To activate it, define a field named _rowSubmit of type <check/> and give it a title.
git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk@449813 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1062,6 +1062,16 @@ public class ModelFormField {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if field is a row submit field.
|
||||
*/
|
||||
public boolean isRowSubmit() {
|
||||
if (!"multi".equals(getModelForm().getType())) return false;
|
||||
if (getFieldInfo().getFieldType() != ModelFormField.FieldInfo.CHECK) return false;
|
||||
if (!CheckField.ROW_SUBMIT_FIELD_NAME.equals(getName())) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
@@ -2557,6 +2567,8 @@ public class ModelFormField {
|
||||
}
|
||||
|
||||
public static class CheckField extends FieldInfo {
|
||||
public final static String ROW_SUBMIT_FIELD_NAME = "_rowSubmit";
|
||||
|
||||
protected CheckField() {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -2190,7 +2190,7 @@ public class HtmlFormRenderer implements FormStringRenderer {
|
||||
|
||||
/**
|
||||
* Renders a link for the column header fields when there is a header-link="" specified in the <field > tag, using
|
||||
* style from header-link-style=""
|
||||
* style from header-link-style="". Also renders a selectAll checkbox in multi forms.
|
||||
* @param buffer
|
||||
* @param context
|
||||
* @param modelFormField
|
||||
@@ -2207,6 +2207,11 @@ public class HtmlFormRenderer implements FormStringRenderer {
|
||||
targetType="plain";
|
||||
}
|
||||
makeHyperlinkString(buffer, modelFormField.getHeaderLinkStyle(), targetType, targetBuffer.toString(), titleText, null);
|
||||
} else if (modelFormField.isRowSubmit()) {
|
||||
if (UtilValidate.isNotEmpty(titleText)) buffer.append(titleText).append("<br>");
|
||||
buffer.append("<input type=\"checkbox\" name=\"selectAll\" value=\"Y\" onclick=\"javascript:toggleAll(this, '");
|
||||
buffer.append(modelFormField.getModelForm().getName());
|
||||
buffer.append("');\"/>");
|
||||
} else {
|
||||
buffer.append(titleText);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user