Announcement

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

    Unable to filter over localized values in ListGrid

    Hi,

    I would like to ask. We are having an issue that we want to filter over column in ListGrid after fields are localized.
    We are calling:

    protected void setClientOnlySupportedServiceDS() {
    if (!clientOnlySupportedServiceDSIsNull()) {
    return;
    }
    DSRequest dsRequest = new DSRequest();
    dsRequest.setWillHandleError(true);

    BcmSupportedServicesDataSource.getInstance().getClientOnlyDataSource(
    new Criteria(BcmBrandFields.name.name(), getCurrentBrandName()), new ClientOnlyDataSourceCallback() {

    @Override
    public void execute(DataSource clientOnlyDS) {
    setCurrentClientOnlyDS(clientOnlyDS);
    }
    }, dsRequest);
    }

    to obtain data from server and in turn data are localized based on i18n mechanism. Data that are store in DataSource are in the format:


    ..
    <value ID="LOAD_MONEY_FROM_PARENT_ACCOUNT" />
    <value ID="LOAD_MONEY_POS" />
    <value ID="LOAD_MONEY_P2P" />
    <value ID="LOAD_MONEY_VOUCHER" />
    <value ID="LOAD_MONEY_CREDIT_CARD" />
    <value ID="LOAD_MONEY_DIREKTUEBERWEISUNG" />

    ..

    that are in turn localized in the property file to be displayed in more user-friendly way to the user:

    service_value_LOAD_MONEY_FROM_PARENT_ACCOUNT = Load money from parent account
    service_value_LOAD_MONEY_POS = Load money with POS terminal
    service_value_LOAD_MONEY_P2P = Load money P2P
    service_value_LOAD_MONEY_VOUCHER = Load money through vouchers
    service_value_LOAD_MONEY_CREDIT_CARD = Load money from external credit card
    service_value_LOAD_MONEY_DIREKTUEBERWEISUNG = Load money from personal bank account
    service_value_LOAD_MONEY_DIRECT_DEBIT = Load money via direct debit

    I debugged the code and the problem is when the filtering is applied in the grid, data are not filtered by localized names but by raw data that are stored in DataSource, i.e. LOAD_MONEY_FROM_PARENT_ACCOUNT, LOAD_MONEY_POS, etc. So if I filter "Load " with space bar nothing is filtered, unless I use
    underscore "Load_".

    The code responsible for filtering looks like this:
    ..
    setCanEdit(true);
    setEditEvent(ListGridEditEvent.CLICK);
    setEditByCell(true);

    setShowRecordComponents(true);
    setShowRecordComponentsByCell(true);

    setShowFilterEditor(true);
    addFilterEditorSubmitHandler(new FilterEditorSubmitHandler() {
    @Override
    public void onFilterEditorSubmit(FilterEditorSubmitEvent event) {
    filterData();
    filterData(event.getCriteria());
    }
    });
    ..

    Is there any way how filtering could be set to filter data based on localized values in the grid and not based on raw data stored in DataSource cache?

    Regards,

    M.

    Attached Files

    #2
    See the DataSource Internationalization overview - the proper way to internationalize something like a <valueMap> in a DataSource is to use our support for fmt:message tags in .ds.xml files. Then our components know about the localized strings and filtering can work as expected.

    You haven't explain how you're getting your localized strings to appear in the UI (a formatter? listGrid.setValueMap() call?) but whatever you're doing, there's no way filtering could be aware of the localized strings you're substituting on the fly.

    Comment

    Working...
    X