Announcement

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

    move checkbox title to left

    Hi,
    CheckboxItem has title on the right by default. I'd like to display the title on the left.
    I first tried setTitleOrientation(TitleOrientation.LEFT). It does not work.

    Finally I worked out a solution with StaticTextItem
    Code:
    	StaticTextItem sti=new StaticTextItem("temp");
    		sti.setTitle("statictext");
    		CheckboxItem cb=new CheckboxItem("cb");
    		//cb.setTitleOrientation(TitleOrientation.LEFT);
    		sti.setDefaultValue("staticText:");
    		sti.setShowTitle(false);
    		sti.setColSpan(1);
    		sti.setClipValue(true);
    		sti.setEndRow(false);
    		sti.setTextAlign(Alignment.RIGHT);
    		
    		cb.setStartRow(false);
    		cb.setColSpan(1);
    		cb.setShowTitle(false);
    		cb.setShowLabel(false);
    This is definitely a hack. Is there an easy way to do this?
    thanks

    -jason

    #2
    showLabel:false, showTitle:true, titleOrientation:"left"

    Comment


      #3
      No, it does not work
      My code is like this
      Code:
      CheckboxItem cb1=new CheckboxItem("cbalign");
      		cb1.setTitle("cb title");
      		cb1.setShowLabel(false);
      		cb1.setShowTitle(true);
      		cb1.setTitleOrientation(TitleOrientation.LEFT);
      I guess this is a bug in SmartGWT.

      -jason

      Comment


        #4
        Solved

        By looking into the JS code,
        I solved it like this
        Code:
        CheckboxItem cb=new CheckboxItem("cb");
        		cb.setTitle("checkbox title");
        		cb.setShowLabel(false);
        		cb.setShowTitle(true);
        		cb.setTitleOrientation(TitleOrientation.LEFT);
        //You have to set this attribute
        		cb.setAttribute("labelAsTitle", true);
        The critical point is that I need to set "labelAsTitle" attribute which is not documented.

        -jason

        Comment


          #5
          Added CheckboxItem.setLabelAsTitle(boolean) in SVN.

          Sanjiv

          Comment

          Working...
          X