1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    15
    Vote Rating
    0
    easytech is on a distinguished road

      0  

    Question grid bind to object

    grid bind to object


    hi, i've a question;
    i'm trying to bind grid to formPanel but how can i convert string value to boolean in binding process?
    i would insert some checkbox in formPanel, and when a grid row is binded i would like to see che chechbox
    selected or unselected

    thank you

    this is my code:

    Code:
    final FormBinding formBindings;
            FormPanel panel = createForm();
            formBindings = new FormBinding(panel, true);
            grid= createGrid();
            formBindings.setStore(grid.getStore());
            grid.setPixelSize(500, 350);
            grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
            grid.getSelectionModel().addListener(Events.SelectionChange,
                    new Listener<SelectionChangedEvent<esLogin>>() {
                        public void handleEvent(
                                SelectionChangedEvent<esLogin> be) {
                            if (be.getSelection().size() > 0) {
                                formBindings.bind((ModelData) be.getSelection()
                                        .get(0));
                            } else {
                                formBindings.unbind();
                            }
                        }
                    });
    Code:
    private FormPanel createForm() {
            FormPanel panel = new FormPanel();
            panel.setHeaderVisible(false);
            panel.setHeight(400);
        
            TextField<String> id = new TextField<String>();
            id.setName("id");
            id.setEnabled(false);
            id.setFieldLabel(span + "ID</span>");
            panel.add(id, new FormData(75, 22));
            
            TextField<String> username = new TextField<String>();
            username.setName("username");
            username.setFieldLabel(span +"Username</span>");
            panel.add(username);}

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,643
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    Set a Converter for the Field in question. This can be done by creating a Converter instance with correct implementations for the two methods to convert between the field and the model, and attaching it to the FieldBinding that it belongs to in the FormBinding.

    formBindings.getBindinging(myBoolField).setConverter(myStringToBooleanConverter);

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar