Announcement

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

    Error with the empty value for a SelectItem (showing markup)

    Hi Isomorphic,

    please see the attached screenshot. The empty value for a SelectItem shows the following text/markup as text: <span aria-hidden="true">&nbsp;</span>

    This happens for me in v9.1p_2014-09-08/EVAL Deployment and in v9.1p_2014-09-01. It did not happen the version I used before (most likely v9.1p_2014-08-22). I do not get any warnings in the Developer Console. Also, the system works. When I select the entry "nothing" is selected, the box is empty. It happens in deployed mode in FF26 and Chrome 37 as well as in Dev Mode in FF26.

    I tried to create a simple testcase for it using the same configuration as my app, but in the Testcase I do not get the error. Do you have an idea what could be causing this, perhaps because of the dates regarding working/not working I provided? If not, I'll have to narrow it down more, but perhaps you have an idea already.

    Testcase BuiltInDs based (as start, unfortunately it does not trigger the error):
    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.AdvancedCriteria;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.fields.SelectItem;
    import com.smartgwt.client.widgets.grid.GroupNode;
    import com.smartgwt.client.widgets.grid.GroupTitleRenderer;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VStack;
    
    public class BuiltInDS implements EntryPoint {
    	private ListGrid boundList;
    	private DynamicForm boundForm;
    	private VStack vs;
    
    	public void onModuleLoad() {
    		KeyIdentifier debugKey = new KeyIdentifier();
    		debugKey.setCtrlKey(true);
    		debugKey.setKeyName("D");
    
    		Page.registerKey(debugKey, new PageKeyHandler() {
    			public void execute(String keyName) {
    				SC.showConsole();
    			}
    		});
    
    		vs = new VStack();
    		IButton reload = new IButton("(Re)load");
    		reload.addClickHandler(new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				if (boundList != null) {
    					vs.removeMembers(boundList, boundForm);
    					boundList.markForDestroy();
    					boundForm.markForDestroy();
    				}
    
    				boundList = new MyLG(DataSource.get("animals"));
    				ListGridField commonName = new ListGridField("commonName");
    				ListGridField status = new ListGridField("status");
    				ListGridFieldLifeSpan lifeSpan = new ListGridFieldLifeSpan("lifeSpan");
    				boundList.setFields(commonName, status, lifeSpan);
    
    				boundForm = new DynamicForm();
    				boundForm.setDataSource(DataSource.get("animals"));
    				SelectItemLifeSpan lifeSpanSI = new SelectItemLifeSpan("lifeSpan");
    				SelectItem statusSI = new SelectItem("status");
    				statusSI.setAllowEmptyValue(true);
    				boundForm.setFields(lifeSpanSI, statusSI);
    
    				vs.addMembers(boundList, boundForm);
    			}
    		});
    		vs.setMembers(reload);
    		vs.draw();
    	}
    
    	public final class MyLG extends ListGrid {
    		public MyLG(final DataSource ds) {
    			super(ds);
    
    			setAutoFetchData(true);
    			setShowFilterEditor(true);
    			setHeight(200);
    			setCanEdit(true);
    			setWidth(1000);
    			setHeight(800);
    		}
    	}
    
    	public final class ListGridFieldLifeSpan extends ListGridField {
    		public ListGridFieldLifeSpan(final String name) {
    			super(name);
    
    			setFilterEditorProperties(new SelectItemLifeSpan(name));
    			setCanFilter(true);
    
    			setGroupTitleRenderer(new GroupTitleRenderer() {
    				public String getGroupTitle(Object groupValue, GroupNode groupNode, ListGridField field, String fieldName, ListGrid grid) {
    					return (String) groupValue + " (" + groupNode.getGroupMembers().length + ")";
    				}
    			});
    		}
    	}
    
    	public class SelectItemLifeSpan extends SelectItem {
    		final private DataSource employeesDS = DataSource.get("employees");
    
    		public SelectItemLifeSpan(String name) {
    			super(name);
    			setOptionDataSource(employeesDS);
    			setValueField(employeesDS.getPrimaryKeyFieldName());
    			setDisplayField("Name");
    			setAllowEmptyValue(true);
    			setSortField("Name");
    			setOptionCriteria(new AdvancedCriteria("MaritalStatus", OperatorId.EQUALS, "married"));
    			setBrowserSpellCheck(false);
    		}
    	}
    
    }
    Best regards,
    Blama
    Attached Files

    #2
    Hi Isomorphic,

    I can't confirm this right now (will do so tomorrow), but I got an idea that I found the cause using Firefox's F12 Tools.

    Please see the markup for the Showcase and for my app in the attached screenshots. All elements I use are databound and all my fields use escapeHtml="true". This is not true for the testcase in my 1st post (based on builtInDS).
    So this escaping might be applied on the contents of the second-last node, escaping the last node (the <span>). Is that possible?

    I'll try removing the escapeHtml in my app tomorrow (or add it to the testcase) and tell you if this changes the results.

    Best regards,
    Blama
    Attached Files

    Comment


      #3
      Hi Isomorphic,

      it is triggered by escapeHTML="true". I added the attribute to the .xml.ds fields employees.Name and animals.status. Otherwise I left it as above.

      Using v9.1p_2014-09-08 I get the <span>-tag as text in both filter-row SelectItems and both DynamicForm SelectItems.

      Best regards,
      Blama

      Comment


        #4
        We've made a change to address this issue. Please try the next nightly build dated Sep 11 or above

        Regards
        Isomorphic Software

        Comment


          #5
          Hi Isomorphic,

          it is working as before for me again, thank you.

          Best regards,
          Blama

          Comment

          Working...
          X