Announcement

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

    StaticTextItem not appearing

    Hello,

    I am trying to create a DynamicForm with FormLayoutType.ABSOLUTE.

    A minimalistic example is this:
    Code:
    public void onModuleLoad() {
        	
        	DynamicForm testForm = new DynamicForm();
    		//testForm.setValuesManager(mainForm);
    		
    		testForm.setItemLayout(FormLayoutType.ABSOLUTE);
    		testForm.setWidth("100%");
    		
    
    		final StaticTextItem nameTitleItem = new StaticTextItem("nameTitle", "Name");
    		nameTitleItem.setTop(40);
    		nameTitleItem.setLeft(0);
    		nameTitleItem.setWidth(100);
    		nameTitleItem.setHeight(40);
    		nameTitleItem.setVisible(true);
    		
    		final SectionItem section1 = new SectionItem();  
    		section1.setWidth(672);
    		section1.setTop(1);
    		section1.setLeft(1);
    		section1.setValue("Persönliche Daten");  
    		section1.setSectionExpanded(true);  
    		section1.setItemIds("nameTitle");
    		
    		testForm.setFields(section1, nameTitleItem );
        	
        	VLayout vlayout = new VLayout();
        	vlayout.setWidth100();
        	vlayout.setHeight100();
        	Label label = new Label("Form test");
        	vlayout.addMember(label);
        	vlayout.addMember(testForm);
        	vlayout.draw();
        }
    Where is the StaticTextItem ? I just can't make it appear anywhere. I tried using setVisible(true), but it doesn't appear. What am I doing wrong?

    Thanks!

    I am using I am using SmartGWT 2.4 EE.

    #2
    Anyone?

    Even with a completely empty form I don't see the StaticTextItem:

    Code:
    public void onModuleLoad() {
        	
        	DynamicForm testForm = new DynamicForm();
    		//testForm.setValuesManager(mainForm);
    		
    		testForm.setItemLayout(FormLayoutType.ABSOLUTE);
    		testForm.setWidth("100%");
    		
    
    		final StaticTextItem nameTitleItem = new StaticTextItem("nameTitle", "Name");
    		nameTitleItem.setTop(40);
    		nameTitleItem.setLeft(0);
    		nameTitleItem.setWidth(100);
    		nameTitleItem.setHeight(40);
    		nameTitleItem.setVisible(true);
    		
    		
    		
    		testForm.setFields( nameTitleItem );
        	
        	VLayout vlayout = new VLayout();
        	vlayout.setWidth100();
        	vlayout.setHeight100();
        	
        	vlayout.addMember(testForm);
        	vlayout.draw();
    
        }
    That's very strange

    Comment


      #3
      It has no value, only a title, and in absolute mode, no items show titles.

      Comment


        #4
        Well that's exactly the reason why I am using StaticTextItem. In the docs it says:

        Code:
        Layout style to use with this form. 
        
        The default of "table" uses a tabular layout similar to HTML tables, but with much more powerful control over sizing, item visibility and reflow, overflow handling, etc. 
        
        itemLayout:"absolute" allows absolute positioning of every form item. This provides maximum flexibility in placement, with the following limitations:
        
        -titles, which normally take up an adjacent cell, are not shown. Use StaticTextItems to show titles
        So I am trying to use StaticTextItems to show a text, as explained in the docs. Why doesn't that work? What am I doing wrong?
        Last edited by edulid; 20 May 2011, 14:55.

        Comment


          #5
          Set the StaticTextItem's value to the desired "title" you want to show.

          Comment

          Working...
          X