Announcement

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

    Can not add hilite rule on field with displayField set

    1. SmartClient Version: v9.0p_2014-01-24/LGPL Development Only (built 2014-01-24)

    2. Firefox 26.0

    3.

    4.

    5.

    6. sample code if applicable
    MainEntryPoint:
    Code:
    package pl.com.tech4.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.DOM;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.types.Autofit;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.Button;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class MainEntryPoint implements EntryPoint, ClickHandler {
    
        private ListGrid countryList;
    
        public void onModuleLoad() {
            DOM.getElementById("loadingPicture").removeFromParent();
            SC.showConsole();
           
            DataSource dataSource = CountryXmlDS.getInstance();
    
            final ListGrid grid = new ListGrid();
            grid.setShowFilterEditor(true);
            grid.setAutoFetchData(true);
            grid.setDataSource(dataSource);
            grid.setAutoFitData(Autofit.VERTICAL);
            this.countryList = grid;
    
            Button button = new Button();
            button.setTitle("Edit Hilites");
            button.addClickHandler(this);
    
            VLayout layout = new VLayout(15);
            layout.setWidth100();
            layout.addMember(grid);
            layout.addMember(button);
            layout.draw();
        }
    
        public void onClick(ClickEvent event) {
            countryList.editHilites();
        }
    
    };
    CountryXmlDS:
    Code:
    package pl.com.tech4.client;
    
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.fields.*;
    
    public class CountryXmlDS extends DataSource {
    
        private static CountryXmlDS instance = null;
    
        public static CountryXmlDS getInstance() {
            if (instance == null) {
                instance = new CountryXmlDS("countryDS");
            }
            return instance;
        }
    
        public CountryXmlDS(String id) {
    
            setID(id);
            setRecordXPath("/List/country");
            DataSourceIntegerField pkField = new DataSourceIntegerField("pk");
            pkField.setHidden(true);
            pkField.setPrimaryKey(true);
    
            DataSourceTextField countryCodeField = new DataSourceTextField("countryCode", "Code");
            countryCodeField.setRequired(true);
            countryCodeField.setValueXPath("countryCode/pk");
            countryCodeField.setDisplayField("countryCodeName");
    
            DataSourceTextField countryCodeNameField = new DataSourceTextField("countryCodeName", "CodeName");
            countryCodeNameField.setValueXPath("countryCode/name");
            countryCodeNameField.setHidden(true);
    
            DataSourceTextField countryNameField = new DataSourceTextField("countryName", "Country");
            countryNameField.setRequired(true);
    
            DataSourceTextField capitalField = new DataSourceTextField("capital", "Capital");
            DataSourceTextField governmentField = new DataSourceTextField("government", "Government", 500);
    
            DataSourceBooleanField memberG8Field = new DataSourceBooleanField("member_g8", "G8");
    
            DataSourceTextField continentField = new DataSourceTextField("continent", "Continent");
            continentField.setValueMap("Europe", "Asia", "North America", "Australia/Oceania", "South America", "Africa");
    
            DataSourceDateField independenceField = new DataSourceDateField("independence", "Nationhood");
            DataSourceFloatField areaField = new DataSourceFloatField("area", "Area (kmē)");
            DataSourceIntegerField populationField = new DataSourceIntegerField("population", "Population");
            DataSourceFloatField gdpField = new DataSourceFloatField("gdp", "GDP ($M)");
            DataSourceLinkField articleField = new DataSourceLinkField("article", "Info");
    
            setFields(pkField, countryCodeField, countryCodeNameField, countryNameField, capitalField, governmentField,
                    memberG8Field, continentField, independenceField, areaField, populationField,
                    gdpField, articleField);
    
            setDataURL("country.data.xml");
            setClientOnly(true);
        }
    }
    country.data.xml:
    Code:
    <List>
    
    <country>
        <continent>North America</continent>
        <countryName>United States</countryName>
        <countryCode>
            <pk>1</pk>
            <name>US</name>
        </countryCode>
        <area>9631420</area>
        <population>298444215</population>
        <gdp>12360000</gdp>
        <independence>1776-07-04</independence>
        <government>federal republic</government>
        <government_desc>2</government_desc>
        <capital>Washington, DC</capital>
        <member_g8>true</member_g8>
        <article>http://en.wikipedia.org/wiki/United_states</article>
    </country>
    <country>
        <continent>Asia</continent>
        <countryName>China</countryName>
        <countryCode>
            <pk>2</pk>
            <name>CH</name>
        </countryCode>
        <area>9596960</area>
        <population>1313973713</population>
        <gdp>8859000</gdp>
        <government>Communist state</government>
        <government_desc>0</government_desc>
        <capital>Beijing</capital>
        <member_g8>false</member_g8>
        <article>http://en.wikipedia.org/wiki/China</article>
    </country>
    
    </List>
    This is test case based on showcase sample.
    There is important modification in the CountryXmlDS.java: the countryCodeField uses values from nested xml attribute via valueXPath and shows values from other hidden field via displayField("countryCodeName").
    This brakes ability to define hilite rule on the countryCodeField. To reproduce:
    1) look at query editor for Code field - its selectItem shows drop down values (US, CH) - this is fine (attached pic0)
    2) now press Edit Hilites and add rule for Country field - this time selectItem shows no drop down values.(attached pic1)
    Thanks for looking into above,
    MichalG
    Attached Files

    #2
    We've made a change to our mainline codebase (the 4.1d / 9.1d branch) to address this issue.
    Please try the next nightly build, dated Feb 4 or above and let us know if you continue to have this problem

    Regards
    Isomorphic Software

    Comment


      #3
      Tested with SmartClient Version: SNAPSHOT_v9.1d_2014-02-04/LGPL Development Only (built 2014-02-04).

      Now I am able to select US/CH while creating a rule on Code field.
      But after saving, hilighting is not applied to corresponding record. And when I try to enter Hilight Editor again, I got following error:
      Code:
      16:46:13.328:MUP3[E]:ERROR:DataSource:isc_DataSource_2:DataSource: isc_DataSource_2: attempt to use DataSource of type iscServer without SmartClient Server option. Please either set clientOnly: true for one-time fetch against dataURL/testFileName or upgrade to SmartClient Pro, Power or Enterprise
      Stack trace:
      
          DataSource.sendDSRequest(_1=>Obj)
          DataSource.performDSOperation(_1=>"fetch", _2=>Obj, _3=>Obj, _4=>Obj)
          DataSource.fetchData(_1=>Obj, _2=>Obj, _3=>Obj)
          ResultSet.fetchRemoteData(_1=>Obj, _2=>0, _3=>75)
          ResultSet.$39w()
          ResultSet.getRangePaged(_1=>0, _2=>1, _3=>undef, _4=>undef)
          ResultSet.$39u(_1=>0, _2=>1, _3=>undef, _4=>undef)
          ResultSet.getRange(_1=>0, _2=>undef, _3=>undef, _4=>undef)
          ListGrid.requestVisibleRows()
          Canvas.filterWithCriteria(_1=>Obj, _2=>Obj{ID:isc_DataSource_2_fetch}, _3=>Obj)
          Canvas.$wo(_1=>"filter", _2=>Obj, _3=>Obj, _4=>Obj)
          [a]MathFunction.invokeSuper(_1=>null, _2=>"$wo", _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef)
          [a]MathFunction.Super(_1=>"$wo", _2=>Array[4], _3=>[object Arguments])
          ListGrid.$wo(_1=>"filter", _2=>Obj, _3=>Obj, _4=>Obj, _5=>undef)
          Canvas.filterData(_1=>Obj, _2=>Obj, _3=>Obj)
          ** recursed on [a]MathFunction.invokeSuper
      Thanks,
      MichalG

      Comment


        #4
        We see the second problem you describe and are working on it (the invalid fetch against a DataSource with a name like isc_DataSource_2).

        However we aren't seeing a problem with the first issue. In our testing we took the following steps:
        - Load the sample
        - Click the "edit hilites" button top show the HiliteEditor
        - Click "Code" to show the filter-editor for the "Code" field
        - Select "US" from the drop down (leaving the operator as "equals (disregard case)")
        - Select a color for both text (red) and background (orange)
        - hit "Save"

        Result - the hilite editor disappears and the "code" cell in the first row shows up with the appropriate hilite styling.
        If you are still seeing the problem where the selected hilite isn't applied, please show us how to reproduce with this sample and we'll take a look.

        Thanks
        Isomorphic Software

        Comment


          #5
          We've now made some changes to address the invalid fetch request. Please try the next nightly build, dated Feb 5 or above

          Regards
          Isomorphic Software

          Comment


            #6
            Originally posted by Isomorphic View Post
            However we aren't seeing a problem with the first issue.
            You are perfectly right - my fault. Please ignore the first issue.
            Sorry and thank you.
            MichalG

            Comment


              #7
              Indeed fixed in 4.1d Feb 5 build. Thanks!

              Any chance that this fix will be merged into 4.0p ?
              MichalG

              Comment


                #8
                Can not add hilite rule on field with optionDataSource

                1.SmartClient Version: v9.1p_2014-03-05/LGPL Development Only (built 2014-03-05)

                2. Firefox 26.0

                6. sample code if applicable

                Similar case: this time using another DataSource as optionDataSource in ComboBoxItem used as editorProperties.
                To reproduce:
                - Edit Hilites, choose Code, select CH from drop-down list, select icon and Save rule - record is not hilited (no icon)
                - Edit Hilites again - the following error is traped on GWT Dev Console (nothing on SmartClient Dev Console)
                Code:
                00:01:29,455 [ERROR] Uncaught exception escaped
                com.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) @com.smartgwt.client.widgets.grid.ListGrid::editHilites()([]): _1 is null 	at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129) 	at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129) 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 	at java.lang.reflect.Method.invoke(Method.java:597) 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) 	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338) 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219) 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279) 	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) 	at com.google.gwt.core.client.impl.Impl.apply(Impl.java) 	at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242) 	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 	at java.lang.reflect.Method.invoke(Method.java:597) 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) 	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293) 	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547) 	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) 	at java.lang.Thread.run(Thread.java:662) Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) @com.smartgwt.client.widgets.grid.ListGrid::editHilites()([]): _1 is null 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:299) 	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) 	at com.smartgwt.client.widgets.grid.ListGrid.editHilites(ListGrid.java) 	at pl.com.tech4.client.MainEntryPoint.onClick(MainEntryPoint.java:54) 	at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:111) 	at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1) 	at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1) 	at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40) 	at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193) 	at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88) 	at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127) 	at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129) 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 	at java.lang.reflect.Method.invoke(Method.java:597) 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) 	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338) 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219) 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) 	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279) 	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) 	at com.google.gwt.core.client.impl.Impl.apply(Impl.java) 	at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242) 	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 	at java.lang.reflect.Method.invoke(Method.java:597) 	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) 	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293) 	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547) 	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) 	at java.lang.Thread.run(Thread.java:662)
                Sample code:
                MainEntryPoint.java
                Code:
                package pl.com.tech4.client;
                
                import com.google.gwt.core.client.EntryPoint;
                import com.google.gwt.user.client.DOM;
                import com.smartgwt.client.data.DataSource;
                import com.smartgwt.client.types.Autofit;
                import com.smartgwt.client.util.SC;
                import com.smartgwt.client.widgets.Button;
                import com.smartgwt.client.widgets.events.ClickEvent;
                import com.smartgwt.client.widgets.events.ClickHandler;
                import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
                import com.smartgwt.client.widgets.grid.ListGrid;
                import com.smartgwt.client.widgets.grid.ListGridField;
                import com.smartgwt.client.widgets.layout.VLayout;
                
                public class MainEntryPoint implements EntryPoint, ClickHandler {
                
                    private ListGrid countryList;
                
                    public void onModuleLoad() {
                        DOM.getElementById("loadingPicture").removeFromParent();
                        SC.showConsole();
                        
                        DataSource dataSource = CountryXmlDS.getInstance();
                
                        final ListGrid grid = new ListGrid();
                        grid.setShowFilterEditor(true);
                        grid.setAutoFetchData(true);
                        grid.setDataSource(dataSource);
                        grid.setAutoFitData(Autofit.VERTICAL);
                        this.countryList = grid;
                        
                        ListGridField countryCodeField = new ListGridField("countryCode");
                        ComboBoxItem countryCodeItem = new ComboBoxItem();
                        countryCodeItem.setOptionDataSource(CountryCodeXmlDS.getInstance());
                        countryCodeItem.setValueField("id");
                        countryCodeItem.setDisplayField("name");
                        countryCodeField.setFilterEditorProperties(countryCodeItem);
                        grid.setFields(countryCodeField);
                        grid.setUseAllDataSourceFields(true);
                        
                        Button button = new Button();
                        button.setTitle("Edit Hilites");
                        button.addClickHandler(this);
                
                        VLayout layout = new VLayout(15);
                        layout.setWidth100();
                        layout.addMember(grid);
                        layout.addMember(button);
                        layout.draw();
                    }
                
                    public void onClick(ClickEvent event) {
                        countryList.editHilites();
                    }
                
                };
                CountryXmlDS.java
                Code:
                package pl.com.tech4.client;
                
                import com.smartgwt.client.data.DataSource;
                import com.smartgwt.client.data.fields.DataSourceIntegerField;
                import com.smartgwt.client.data.fields.DataSourceTextField;
                import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
                
                public class CountryXmlDS extends DataSource {
                
                    private static CountryXmlDS instance = null;
                
                    public static CountryXmlDS getInstance() {
                        if (instance == null) {
                            instance = new CountryXmlDS("countryDS");
                        }
                        return instance;
                    }
                
                    public CountryXmlDS(String id) {
                
                        setID(id);
                        setRecordXPath("/List/country");
                        DataSourceIntegerField pkField = new DataSourceIntegerField("pk");
                        pkField.setHidden(true);
                        pkField.setPrimaryKey(true);
                
                        DataSourceTextField countryCodeField = new DataSourceTextField("countryCode", "Code");
                        countryCodeField.setRequired(true);
                        countryCodeField.setValueXPath("countryCode/pk");
                        countryCodeField.setDisplayField("countryCodeName");
                        countryCodeField.setForeignKey("codeDS.pk"); //!!
                        ComboBoxItem countryCodeItem = new ComboBoxItem();
                        countryCodeItem.setOptionDataSource(CountryCodeXmlDS.getInstance());
                        countryCodeItem.setValueField("id");
                        countryCodeItem.setDisplayField("name");
                        countryCodeField.setEditorProperties(countryCodeItem);
                
                        DataSourceTextField countryCodeNameField = new DataSourceTextField("countryCodeName", "CodeName");
                        countryCodeNameField.setValueXPath("countryCode/name");
                        countryCodeNameField.setHidden(true);
                        
                        DataSourceTextField countryNameField = new DataSourceTextField("countryName", "Country");
                        countryNameField.setRequired(true);
                
                        setFields(pkField, countryCodeField, countryCodeNameField, countryNameField);
                
                        setDataURL("country.data.xml");
                        setClientOnly(true);
                    }
                }
                CountryCodeXmlDS.java
                Code:
                package pl.com.tech4.client;
                
                import com.smartgwt.client.data.DataSource;
                import com.smartgwt.client.data.fields.DataSourceIntegerField;
                import com.smartgwt.client.data.fields.DataSourceTextField;
                
                public class CountryCodeXmlDS extends DataSource {
                
                    private static CountryCodeXmlDS instance = null;
                
                    public static CountryCodeXmlDS getInstance() {
                        if (instance == null) {
                            instance = new CountryCodeXmlDS("codeDS");
                        }
                        return instance;
                    }
                
                    public CountryCodeXmlDS(String id) {
                
                        setID(id);
                        setRecordXPath("/List/code");
                        DataSourceIntegerField pkField = new DataSourceIntegerField("pk");
                        pkField.setHidden(true);
                        pkField.setPrimaryKey(true);
                
                        DataSourceTextField nameField = new DataSourceTextField("name", "Name");
                
                        setFields(pkField, nameField);
                
                        setDataURL("code.data.xml");
                        setClientOnly(true);
                    }
                }
                country.data.xml
                Code:
                <List>
                
                <country>
                    <continent>North America</continent>
                    <countryName>United States</countryName>
                    <countryCode>
                        <pk>1</pk>
                        <name>US</name>
                    </countryCode>
                </country>
                <country>
                    <continent>Asia</continent>
                    <countryName>China</countryName>
                    <countryCode>
                        <pk>2</pk>
                        <name>CH</name>
                    </countryCode>
                </country>
                
                </List>
                code.data.xml
                Code:
                <List>
                
                <code>
                    <pk>1</pk>
                    <name>US</name>
                </code>
                <code>
                    <pk>2</pk>
                    <name>CH</name>
                </code>
                
                </List>
                Thanks for looking into it,
                MichalG

                Comment


                  #9
                  Any news on this problem (sample code in earlier post)

                  "com.google.gwt.core.client.JavaScriptException: (TypeError) @com.smartgwt.client.widgets.grid.ListGrid::editHilites()([]): criterion is null"

                  would be appreciated because it prevents hilighting on foreign key fields.
                  Also, this used to work perfectly in the past for example in SmartClient Version: v8.3p_2013-01-09/LGPL Development Only (built 2013-01-09)
                  Thanks,
                  MichalG

                  Comment

                  Working...
                  X