Announcement

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

    Issue when using setWidth("*") on ComboBoxItem in ListGrid

    Hi,

    SmartClient Version: SC_SNAPSHOT-2011-03-01/EVAL Deployment
    FireFox 3.6.15

    I have found the following issue:

    When I use setWidth("*") in my custom editor, I get an uncaught javascript exception when clicking the picker icon (edit mode in ListGrid).
    Subsequently the drop down list isn't shown.

    When taking out the setWidth("*") everything works fine and the list is displayed.

    I have added a standalone test case below.

    Regards,
    Bart

    Code:
    Uncaught JavaScript exception [_4.body is undefined] in http://127.0.0.1:8888/standalone/sc/modules/ISC_Forms.js, line 1999

    Code:
    public class MyComboBoxItem extends SimpleType {   
        public MyComboBoxItem() {   
            super("myComboBoxType", FieldType.ANY);   
    
        }  
    
    }
    
    
    public class MyComboBoxEditor extends ComboBoxItem {
    	
    	public MyComboBoxEditor() {
    		
          this.setShowPickerIcon(true);
          this.setAddUnknownValues(false);
          this.setDefaultToFirstOption(false);
          this.setCompleteOnTab(true);
          this.setWidth("*"); => causes an uncaught java script exception!!!
                  	        
          LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    	  valueMap.put("1", "Red");
    	  valueMap.put("2", "Green");
    	  valueMap.put("3", "Blue");	            
    	  this.setValueMap(valueMap);
    		
    	}
    }
    
    
    public class Standalone implements EntryPoint {
    	
    	/**
    	 * Container for either the login window or the workspace;
    	 */
    	private static Canvas masterPanel = null;
    
        public void onModuleLoad() {   
        	
    		//masterPanel should be a Layout
    		// this way, it will re-layout its members if the browser gets resized
    		masterPanel = new Canvas(); 
    		masterPanel.setHeight100();
    		masterPanel.setWidth100();
    		masterPanel.setStyleName("pageBackground"); //background style from skin
        	  
            DataSource dataSource = new DataSource();   
                     
            DataSourceField myComboBoxField = new DataSourceField();   
            myComboBoxField.setName("comboBoxField");   
            myComboBoxField.setTitle("comboBoxField");   
            myComboBoxField.setType(new MyComboBoxItem());   
            myComboBoxField.setEditorType(new MyComboBoxEditor());
      
            dataSource.setFields(myComboBoxField);   
            
            ListGridRecord[] result = new ListGridRecord[1];
            result[0] = new ListGridRecord();
            result[0].setAttribute("comboBoxField", "2");
               
            //the order list grid   
            ListGrid ordersList = new ListGrid();   
            ordersList.setHeight(170);   
            ordersList.setWidth(500);
            ordersList.setCanEdit(true);
            ordersList.setDataSource(dataSource);
            ordersList.setData(result);
       
    		masterPanel.addChild(ordersList);
    		masterPanel.draw();	
        }
    }

    #2
    This shouldn't crash and we'll fix this, however, what effect were you expecting? ComboBoxItems already fill the column.

    Comment


      #3
      Agreed, but we are also using this as a FormItem.

      Comment


        #4
        Has this issue been resolved?

        Comment


          #5
          We've just put a fix for this in - it'll be present in the next nightly build.

          Comment


            #6
            Fix works like a charm, thanks!

            Comment

            Working...
            X