Announcement

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

    Databound dependent selects using XJSONDatasource

    HI, I have a datasource using XJSONDataSource. I tried to do the databaound dependent selects example of the smart gwt showcase but it didn't work for me. I don't know what am I doing wrong. I want to know if the PickListFilterCriteria works for JSONP.

    I hope that somebody can help me.

    Thanks a lot. This is the code there I have.

    Code:
     
    
    XJSONDataSource clienteDS = new XJSONDataSource();
    XJSONDataSource pedidoDS = new XJSONDataSource();
    
    clienteDS.setDataFormat(DSDataFormat.JSON);
    clienteDS.setDataURL("http://localhost/clasben/backend/public/opedido/cliente");
    			
    pedidoDS.setDataFormat(DSDataFormat.JSON);
    pedidoDS.setDataURL("http://localhost/clasben/backend/public/opedido/razon");
    
    final ComboBoxItem comboBoxItem1 = new ComboBoxItem();		
    comboBoxItem1.setName("cliente");
    comboBoxItem1.setTitle("Cliente");
    comboBoxItem1.setDefaultToFirstOption(true);
    comboBoxItem1.setDisplayField("nombre");
    comboBoxItem1.setValueField("id");
    comboBoxItem1.setOptionDataSource(clienteDS);			
    comboBoxItem1.addChangeHandler(new ChangeHandler() {  
    public void onChange(ChangeEvent event) {
    form.clearValue("rfc"); 
     }  
    }); 
    			
    final ComboBoxItem comboBoxItem = new ComboBoxItem(){				
    protected Criteria getPickListFilterCriteria(){
    String id_cliente = (String) comboBoxItem1.getValue();
    Criteria criteria = new Criteria("id_cliente", id_cliente);
    return criteria;
    }
    };
    comboBoxItem.setName("rfc");
    comboBoxItem.setTitle("Razon Social");
    comboBoxItem.setDisplayField("rfc");
    comboBoxItem.setValueField("id");
    comboBoxItem.setOptionDataSource(pedidoDS);

    #2
    So is it just that your second combobox isn't filtering or is your second box not populated at all? What is id_cliente versus id? Post your data source definitions.

    Comment

    Working...
    X