Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

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

$
0
0
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 Images
File Type: png Screenshot_Markup_In_DisplayValue.png (5.3 KB)

Viewing all articles
Browse latest Browse all 4756

Trending Articles