Announcement

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

    Bug in SelectItem.setImageURLPrefix(String) / setImageURLSuffix(String) ?

    Hi Isomorphic,

    I was coding a country-Dropdown like in http://www.smartclient.com/smartgwt/...bobox_category.

    I couldn't figure out to do it in a databound fashion with optionDataSource(). Is this possible?
    So I fetch() on my own from the DS.
    At 1st I tried with setImageURLPrefix("flags/16/") and setImageURLSuffix(".png"). But the result is the following:
    In the List after clicking the SelectItem, the images are missing 404, because the full URL is "/images/us" or "/images/de" (example given).
    After selecting an entry the correct flag is shown (with path to /[PROJECT]/images/flags/16/us.png).
    I think there might be something wrong in these two methods.

    My current workaround is not to use setImageURLPrefix and do it on my own:
    Code:
    countryDS.fetchData(null, new DSCallback() {
    	@SuppressWarnings("unchecked")
    	@Override
    	public void execute(DSResponse response, Object rawData, DSRequest request) {
    		setValueMap((LinkedHashMap<String, String>) response.getDataAsRecordList().getValueMap("ID",
    				"SHORTNAME_DE"));
    		LinkedHashMap<String, String> fullUrl = new LinkedHashMap<String, String>();
    		LinkedHashMap<String, String> lhm = (LinkedHashMap<String, String>) response.getDataAsRecordList()
    				.getValueMap("ID", "ISO_3166_1_ALPHA_2");
    		for (String id : lhm.keySet()) {
    			fullUrl.put(id, "flags/16/" + lhm.get(id) + ".png");
    		}
    		setValueIcons(fullUrl);
    	}
    }, new DSRequest() {
    	{
    		SortSpecifier ss = new SortSpecifier("SHORTNAME_DE", SortDirection.ASCENDING);
    		SortSpecifier[] sortSpecifier = new SortSpecifier[1];
    		sortSpecifier[0] = ss;
    		setSortBy(sortSpecifier);
    		String[] exportFields = new String[3];
    		exportFields[0] = "ID";
    		exportFields[1] = "SHORTNAME_DE";
    		exportFields[2] = "ISO_3166_1_ALPHA_2";
    		setExportFields(exportFields);
    	}
    });
    Another question: Is it easily possible to have a ComboBox instead of a SelectItem with the flag-icons, Countryname (with matching via Textmatchstyle.SUBSTRING) and Country-callingcode (=3 columns at all)?


    Thanks,
    Blama
Working...
X