Announcement

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

    DateItem alignment

    Hi ,

    I am using SmartGWT Pro 2.4 version.

    I am trying to set all the fields in a dyanamic form to left alignment. But thing is the date field alone is not aligned to left side.
    I set all alignment in ds as well as in my code , but none is working for the dateItem. The text is always aligned to the Right.

    Code:
                            FormItem[] frmItems = form.getFields();
    			for (FormItem item : frmItems) {
    				item.setTitleAlign(Alignment.LEFT);
    				item.setAlign(Alignment.LEFT);
    			}
    
    form.getField("deadline").setAlign(Alignment.LEFT);


    Code:
    <field name="deadline" title="Deadline" type="date"
    			useTextField="true" editorType="date" dateFormatter="toEuropeanShortDate" align="left"/>
    I also tried setting an editor type to the specific date field all all formatting like setUseTextField(), setTextAlign() etc. But no use..

    Please throw some light on this one..

    Thanks
    Rajesh

    #2
    What exactly are you trying to align:

    1. text in the ListGrid header (ListGridField.setAlign())

    2. text in the ListGrid cell (ListGridField.setCellAlign())

    3. text inside the text field in the DateItem (DateTime.setTextAlign())

    Comment


      #3
      Actually I am trying to align text inside a date field.

      All fields are set to the dynamic form from a DataSource using

      dynamicform.setDataSource(DataSource.get("ds"));

      I tried
      Code:
      dynamicform.getItem("date-field").setTextAlign();
      - Did not work.

      I tried
      Code:
      DateItem dateItem = new DateItem();
      dateItem.setTextAlign();
      dynamicform.getItem("date-field").setEditorType(dateItem);
      -Did not work.

      I don't want to set fields manually into a dynamic form. Is there any other way to align text inside a date item?

      Comment


        #4
        Set the fields on the DynamicForm. If you're perceiving this as manual, you need to read the Data Binding chapter of the QuickStart Guide - it's the approach that involves the least code and is the most robust with respect to further changes.

        Comment


          #5
          Thanks for the quick reply.

          Will try that.

          Comment

          Working...
          X