1. #1
    Ext User
    Join Date
    May 2009
    Posts
    9
    Vote Rating
    0
    RaulDM is on a distinguished road

      0  

    Default How can I Bind a ComboBox with the selection Model of a Grid..??

    How can I Bind a ComboBox with the selection Model of a Grid..??


    I have a Grid which is holding Person Records.

    My Person Bean:

    public class person{
    int id;
    String name;
    Department dept;

    public void setId(String id){id=id;}
    public String getId(){return id;}
    public void setName(String name){name = name;}
    public String getName(){return name;}
    public void setDepartment(Department d){dept=d;}
    public Department getDepartment(){return dept;}
    }

    My Department Class

    public class Department{
    int id;
    int name;

    public void setId(String id){id=id;}
    public String getId(){return id;}
    public void setName(String name){name=name;}
    public String getName(){return name;}
    }

    Now my Grid is holding the list of Persons and it has columns like:

    Person Name Department Name
    John CSE
    Mac ENT
    Robert Instrumentation

    And I have a form which is bind with this Grid via form Binding and it looks like

    Person Name: <-----------------Text Field
    Department name : <-----------------Combox Box

    I bind the Grid with my form and when I click the row contains Robert, the Person Name field of my Form displays Robert, but the Department name Combo does not showing anything.

    The Depart name combo has been populated with the Bean Model data created from the Department Bean, and thus it holds the name of all the existing departments.

    Now what I want to do is to when I select a row in my Grid, say Row having the person name Robert, the Department name Combo Box should force its selection to the department to which Robert belongs.

    How can I do this..??

    Plz help...!!

    Raul

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Please take a look at the examples. Exactly this is handled there.

  3. #3
    Ext User
    Join Date
    May 2009
    Posts
    9
    Vote Rating
    0
    RaulDM is on a distinguished road

      0  

    Default Thanks for the reply

    Thanks for the reply


    Hello sven,

    Thanks for your reply.

    I had checked the Basic Binding example provided in the gxt-2.0-m3 bundle. But it was a bit simpler than my issue.

    I have two ListStore<BeanModel> s,
    First one PersonStore<BeanModel> to populate my Grid and I had attached the same with my FormBinding as

    Grid<BeanModel> grid = createEditorGrid();
    grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    grid.getSelectionModel().addListener(Events.SelectionChange, new Listener<SelectionChangedEvent<BeanModel>>() {
    publicvoid handleEvent(SelectionChangedEvent<BeanModel> be) {
    if (be.getSelection().size() > 0) {
    formBindings.bind((ModelData) be.getSelection().get(0));
    } else {
    formBindings.unbind();
    }
    }
    });
    add(grid);
    FormPanel panel = createForm();
    formBindings = new FormBinding(panel, true);
    formBindings.setStore((Store<BeanModel>) grid.getStore());
    add(panel);

    Now i have a DepartmentStore<BeanModel> to populate my ComboBox in my form panel as

    (Note: I am unable to use SimpleComboBox with my ListStore<BeanModel> generated from Department Bean):

    final ComboBox<BeanModel> dept = new ComboBox<BeanModel>();
    dept.setStore(deptStore);
    dept.setDisplayField("name");
    dept.setValueField("dept_id");
    dept.setFieldLabel("Department");
    dept.setTypeAhead(true);
    dept.setEditable(false);
    //FieldBinding b = new SimpleComboBoxFieldBinding(dept, "name");
    // formBindings.addFieldBinding(b);
    left.add(dept);

    Now the problems are:

    1. I am not able to attach the DepartmentStore with the Combo field if I use a SimpleComboBox.

    2. If somehow, I would make it possible to attach the ListStore with the SimpleComboBox, then my question is, will it become possible to change the selection of the ComboBox each time I select a different Row in my Grid...?? The new Combo field Selection will be of course related to the concerned person in the selected row of the Grid.

    Now if I want to assign a different department to a Person the Combo should also provide this facility. My form will do the rest of the modification part.



    If I clear at my issue….. plz put some help…!!



    Regards
    Raul.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi