I have a structure with combo-box, and those combo-box
has the following form:

Municipios is Cities in english.

public Store createMunicipiosStore() {
        Object[][] municipios = this.getMunicipiosDoBD();

        //id_municipio,id_subbacia,id_bacia,nome_municipio
        final Store municipiosStore = new SimpleStore(new String[] {
                MUNICIPIO_ID, SUBBACIA_ID, BACIA_ID, NOME_MUNICIPIO },
                municipios);
        municipiosStore.load();
        return municipiosStore;
    }


The data are stored in an array of Object. And there Listeners to link
filter and a combo-box from another.
In this case:
Combo box1 = Municipios (Cities)
Combo = box2 Postos (Locations)

But the filtering is being done in the style starswith(similar the String
API), it is as if he were a starswith in the code of the object.

type, if the code (ID) of the minicipio(City) is (1) in the list of posts
will also appear that the posts have counties with codes 10, 11, 12 etc.

    public Store createPostoStore() {
    Object[][] postos = this.getPostosDoBD();
        final Store postosStore = new SimpleStore(new String[] { POSTO_ID,
                MUNICIPIO_ID, SUBBACIA_ID, BACIA_ID, NOME_POSTO }, postos);
        postosStore.load();
        return postosStore;

    }

    public Store createMunicipiosStore() {
        Object[][] municipios = this.getMunicipiosDoBD();

        //id_municipio,id_subbacia,id_bacia,nome_municipio
        final Store municipiosStore = new SimpleStore(new String[] {
                MUNICIPIO_ID, SUBBACIA_ID, BACIA_ID, NOME_MUNICIPIO },
                municipios);
        municipiosStore.load();
        return municipiosStore;
    }


And the listener to link and filter is:

    CBMunicipio.addListener(this.createListenerAdapter(CBPostoDoMunicipio,
                postoDoMunicipioStore, MUNICIPIO_ID));

    public ComboBoxListenerAdapter createListenerAdapter(
            final ComboBox combBox, final Store store, final String id) {
        ComboBoxListenerAdapter listener = new ComboBoxListenerAdapter() {
            public void onSelect(ComboBox comboBox, Record record, int
index) {
                combBox.setValue("");
                store.filter(id, comboBox.getValue());
            }
        };
        return listener;
    }


The codes (IDS) of both minicipios(City) as the postos(locations) are
integers.

Thank you for the attention.
--------------------------------------------------------------------------------------------------
"Se um dia tiver que escolher entre o mundo e o amor... Lembre-se:
Se escolher o mundo, ficará sem o amor, mas se escolher o amor,
com ele conquistará o mundo." (Albert Einstein)
╔════════════════════════════════════════╗
ROMERYTO VIEIRA LIRA
Bacharelando em Ciência da Computação - UFCG
Membro do SegHidro2 - LSD - http://seghidro.lsd.ufcg.edu.br
Membro do Grupo de Suporte Guardians - www.lcc.ufcg.edu.br
Página Pessoal: http://romeryto.googlepages.com
Blog: http://olhartecnologico.blogspot.com
╚════════════════════════════════════════╝

Pensou em imprimir este e-mail? Isto é mesmo necessário? Poupe o meio
ambiente.
----------------------------------------------------------------------------------------------------------------------------

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to