/** * If this ListGrid is showing a filter row (showFilterEditor : true), this property can be used to specify properties for the * appropriate filter form item. * * @param filterEditorProperties the filter editor properties */ public void setFilterEditorProperties(FormItem filterEditorProperties) { JavaScriptObject editorConfig = filterEditorProperties.getConfig(); setAttribute("filterEditorProperties", editorConfig); }
/** * Sets the default FormItem to be used whenever this field is edited (whether in a grid, form, or other component). * <P> If unset, a FormItem will be automatically chosen based on the type of the field. * <p><br> * <b>Note</b> : When you supply a custom FormItem via setEditorType(), you're really providing properties which are then used * to create multiple FormItems (eg, in grids, forms and trees) and there's an underlying limitation here where event handlers * have to be written to dynamically receive the actual FormItem rather than relying on "this" (because there's more than one "this"). * * @param editorType editorType Default value is null */ public void setEditorType(FormItem editorType) { //only set the editorType attribute if the passed editorType is a concrete subclass of FormItem if(!editorType.getClass().getName().equals(FormItem.class.getName())) { String fiEditorType = editorType.getAttribute("editorType"); //fallback to type if editorType is not specified if(fiEditorType == null) fiEditorType = editorType.getType(); if (fiEditorType != null) setAttribute("editorType", fiEditorType); } JavaScriptObject editorConfig = editorType.getConfig(); setAttribute("editorProperties", editorConfig); }
/** * Name of the FormItem properties to use for editing. <P> The type of FormItem to use for * editing is normally derived automatically from {@link com.smartgwt.client.widgets.form.fields.FormItem#getType * type}, which is the data type of the field, by the rules explained {@link com.smartgwt.client.types.FormItemType here}. * <p><br> * <b>Note</b> : When you supply a custom FormItem via setEditorType(), you're really providing properties which are then used to create * multiple FormItems (eg, in grids, forms and trees) and there's an underlying limitation here where event handlers have to be written to * dynamically receive the actual FormItem rather than relying on "this" (because there's more than one "this"). * * @param editorType editorType Default value is null */ public void setEditorType(FormItem editorType) { //only set the editorType attribute if the passed editorType is a concrete subclass of FormItem if(!editorType.getClass().getName().equals(FormItem.class.getName())) { String fiEditorType = editorType.getAttribute("editorType"); //fallback to type if editorType is not specified if(fiEditorType == null) fiEditorType = editorType.getType(); if (fiEditorType != null) setAttribute("editorType", fiEditorType); } JavaScriptObject editorConfig = editorType.getConfig(); setAttribute("editorProperties", editorConfig); }
/** * Name of form item type to use for the form item created to edit this field. (Only used if this field is * editable). Note: If this is not specified, the edit-form item type may be derived from the editorType property, * typically inherited from datasource fields, or from the type of the field (showing the appropriate form item for * the data-type). See the Grid Editing overview for more on editing ListGrid fields. * * <p><br> * <b>Note>: When you supply a custom FormItem via setEditorType(), you're really providing properties which are then used to * create multiple FormItems (eg, in grids, forms and trees) and there's an underlying limitation here where event handlers have * to be written to dynamically receive the actual FormItem rather than relying on "this" (because there's more than one "this"). * * @param editorType the editor type */ public void setEditorType(FormItem editorType) { //only set the editorType attribute if the passed editorType is a concrete subclass of FormItem if(!editorType.getClass().getName().equals(FormItem.class.getName())) { String fiEditorType = editorType.getAttribute("editorType"); //fallback to type if editorType is not specified if(fiEditorType == null) fiEditorType = editorType.getType(); if (fiEditorType != null) setAttribute("editorType", fiEditorType); } JavaScriptObject editorConfig = editorType.getConfig(); setAttribute("editorProperties", editorConfig); }
/** * If this ListGrid is showing a filter row, this property can be used to specify the form item class to use * for the filter form item associated with this field (Only used if this field is not canFilter:false). * <br> * <p/> * <b>Note</b>: If this is not specified, the edit-form item type may be derived from the 'editorType' property, * typically inherited from datasource fields, or from the 'type' of the field (showing the appropriate form item for the data-type). * * @param filterEditorType the filter editor type */ public void setFilterEditorType(FormItem filterEditorType) { setAttribute("filterEditorType", filterEditorType.getType()); JavaScriptObject editorConfig = filterEditorType.getConfig(); setAttribute("filterEditorProperties", editorConfig); }
private static JavaScriptObject toJsArray(FormItem[] formItems) { JavaScriptObject jsArray = JSOHelper.createJavaScriptArray(); int i = 0; for (FormItem formItem : formItems) { JavaScriptObject config = formItem.getConfig(); JSOHelper.setAttribute(config, "name", formItem.getName()); JSOHelper.setAttribute(config, "type", formItem.getType()); JSOHelper.setArrayValue(jsArray, i, config); i++; } return jsArray; }