Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    "CREATED" field seems to reserved

    Dear Support,

    I'm trying to create a Canvas Item containing two DateItem's to have full control on the layout, as suggested in the DateRangeItem documentation.

    Here is a minimalist source code:

    Code:
    import java.util.Date;
    
    import com.fircosoft.cdb.client.localization.Localization;
    import com.smartgwt.client.data.Criterion;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.types.TextMatchStyle;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.FormItemCriterionGetter;
    import com.smartgwt.client.widgets.form.fields.CanvasItem;
    import com.smartgwt.client.widgets.form.fields.FormItem;
    
    public class FormDateRangeItem extends CanvasItem {
    
    	
    	FormDateItem	fromItem	= new FormDateItem();
    	FormDateItem	toItem		= new FormDateItem();
    	DynamicForm		form		= new DynamicForm();
    	
    	public FormDateRangeItem(String name, String title) {
    		super(name, Localization.translate(title));
    		
    		fromItem.setShowTitle(false);
    		fromItem.setName(name + "_FROM");
    		fromItem.setOperator(OperatorId.GREATER_OR_EQUAL);
    		toItem.setOperator(OperatorId.LESS_OR_EQUAL);
    		toItem.setTitle("$toDateRange");
    		toItem.setName(name + "_TO");
    		form.setNumCols(3);
    		form.setItems(fromItem, toItem);
    		form.setColWidths(160, 50, 160);
    		this.setShouldSaveValue(true);
    		this.setCriterionGetter(new FormItemCriterionGetter() {
    			
    			@Override
    			public Criterion getCriterion(DynamicForm form, FormItem item, TextMatchStyle textMatchStyle) {
    				return new Criterion(item.getName(), OperatorId.BETWEEN_INCLUSIVE, fromItem.getValueAsDate(), toItem.getValueAsDate());
    			}
    			
    			@Override
    			public Criterion getCriterion(DynamicForm form, FormItem item) {
    				return new Criterion(item.getName(), OperatorId.BETWEEN_INCLUSIVE, fromItem.getValueAsDate(), toItem.getValueAsDate());
    			}
    		});
    		this.setCanvas(form);
    	}
    
    }
    I link this custom item to a field named "CREATED" in a dynamic form:

    Code:
    <field name="CREATED" type="creatorTimestamp" title="$created" hidden="false" />
    The problem I have is that the two date pickers are disabled, whatever I do... BUT, If I rename my field in the datasource like this:

    Code:
    <field name="FOO" type="creatorTimestamp" title="$created" hidden="false" nativeName="CREATED"/>
    ... and of course link my canvas item to FOO instead of CREATED, everything works as expected.

    ... So my question is simple... is the word "CREATED" reserved for some internal features of SmartGwt ?

    Thanks,

    Thomas

    #2
    The word CREATED is not reserved as a fieldName in this way and from our testing we are not reproducing your result.

    However one thing worth noting is that a field of type "creatorTimestamp" is (correctly) non editable by default, so in a normal DynamicForm you are likely to see the field be disabled.

    However, if you instantiate a SearchForm rather than a DynamicForm the generated FormItem should be enabled (as the field is not canFilter:false)

    We suspect that this is somehow responsible for the behavior you've seen. Can you take another look and let us know if you continue to see problematic behavior

    Thanks
    Isomorphic Software

    Comment


      #3
      Thanks for your reply.

      If I remember correctly, I suspsected that the field type could be the source of the problem and changed it to date... but the problem persisted.
      Anyway, if I change the DynamicForm to a SearchForm, it's working as expected. Many thanks for your help.

      Regards,
      Thomas

      Comment

      Working...
      X