Results 1 to 3 of 3

Thread: TreeGrid and CellEditor

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Sep 2011
    Location
    Leipzig, Germany
    Posts
    75
    Vote Rating
    2
      0  

    Default TreeGrid and CellEditor

    Hi,

    I have a TreeGrid and have added CellEditors to two columns. Both columns are not the tree column (a date and a comment). The tree should not support editing on every row, so how I can prevent the rendering of the editor on some rows? the CellEditor only holds a column/row number, how I can get the ModelData instance to check the possibility of editing in this row?

    Thanks
    Andr

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      0  

    Default

    You could listen to the BeforeEdit event and cancel that if that specific cell should not be edited.

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Location
    Leipzig, Germany
    Posts
    75
    Vote Rating
    2
      0  

    Default

    I have found it:

    Code:
    tree.addListener(Events.BeforeEdit, new BeforeEditListener());
    
    private class BeforeEditListener implements Listener<GridEvent<ModelData>> {
    
       public void handleEvent(GridEvent<ModelData> event) {
          ModelData model = event.getModel();
    
          // check, if the model is on the right place to edit
          // use the store
       }
    }
    The "tree" should also an instance of EditorTreeGrid. Don't forget to set the clicksToEdit:

    Code:
    tree.setClicksToEdit(ClicksToEdit.TWO);
    ~Andr

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •