1. #1
    Ext User
    Join Date
    May 2008
    Posts
    8
    Vote Rating
    0
    mkn is on a distinguished road

      0  

    Default EditGrid and Checkbox

    EditGrid and Checkbox


    It is easy to add a checkbox to an Editgrid and showing data goes just fne. However, I have not been able to find out how to grab any edit events from the box. What I have done is this:
    Code:
    ccolumn = new CheckColumnConfig("isIt", "IsIt?",35);
    // create a new checkbox
    CheckBox cb = new CheckBox();
    cb.setAutoValidate(true);
    // set the column editor
    ccolumn.setEditor(new CellEditor(cb ));
    // add the column
    configs.add(ccolumn);  
    //.. etc
    cm = new ColumnModel(configs);  
    cp = new ContentPanel();  
    //..
    Listener CbListener = new Listener(){
            public void handleEvent(BaseEvent be) {
                Window.alert("foo from the grid");
            }        
    };
    When getting data for the grid I have done as follows:

    Code:
    grid.addListener(Events.ValidateEdit,CbListener);
    grid.addPlugin(ccolumn);  
    // add the grid to the contentpanel
    cp.add(grid);
    The "ValidateEdit" is just an example - I have tried BeforeEdit and AfterEdit as well. The event fires just fine with a TextField but not with the checkbox field.

    What am I doing wrong here? Am I totally lost with the editors? Are there any special things to take into account when using other than TextField cell editors?

    Markku

  2. #2
    Ext User
    Join Date
    Oct 2008
    Location
    Atlanta ,GA
    Posts
    239
    Vote Rating
    0
    kolli is on a distinguished road

      0  

    Default


    have you tried "Events.Change" since that event is fired when a checkbox state is changed.

  3. #3
    Ext User
    Join Date
    May 2008
    Posts
    8
    Vote Rating
    0
    mkn is on a distinguished road

      0  

    Default


    Quote Originally Posted by kolli View Post
    have you tried "Events.Change" since that event is fired when a checkbox state is changed.
    Yes, actually after trying all imaginable events I finally understood that CellEditor cb editor actually does not even replace the icon displayed. For some reason unknown to me I cannot even set the CellEditor for the CheckBox column. A TextField editor in the previous cell works just fine.

    And I simply cannot see any of the events fire. No idea why. This weird behaviour probably makes me revert part of the project back to Flex. I have not yet seen any working example of an EditGrid checkbox, the examples do not have one and nothing found in the mighty Internet.

    I am very grateful if anybody who has done this before is willing to share the secret...

    Markku

  4. #4
    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


    You need to override onMouseDown of CheckColumnConfig. CheckColumnConfig doent use a real cell editor.

  5. #5
    Ext User
    Join Date
    May 2008
    Posts
    8
    Vote Rating
    0
    mkn is on a distinguished road

      0  

    Default


    Quote Originally Posted by sven View Post
    You need to override onMouseDown of CheckColumnConfig. CheckColumnConfig doent use a real cell editor.
    Thanks, Sven, I did not spot that one in the documentation (if it is there). Now things look a bit better though I need to create an absraction layer on top of the EditGrid mess!

    Markku

  6. #6
    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


    There is no mess in the EditorGrid. It is just that CheckColumnConfig isnt using any CellEditor.

  7. #7
    Ext User
    Join Date
    May 2008
    Posts
    8
    Vote Rating
    0
    mkn is on a distinguished road

      0  

    Default


    Sorry, I what I meant was that I really need to create an special component that incapsulates EditorGrid and a few other components - just to save time and make the code more concise.

    For me any framework is a mess before I have my own abstraction level ready - and it is looking better already

Thread Participants: 2