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:
CountryXmlDS:
country.data.xml:
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
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(); } };
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); } }
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>
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
Comment