Results 1 to 3 of 3

Thread: Disable row in grid

  1. #1

    Default Disable row in grid

    Hello community!!!
    I need to disable specific row in grid, any idea how i can do it???

    Thanks

  2. #2
    Sencha User
    Join Date
    Mar 2011
    Posts
    79

    Default

    If you mean disable from editing i don't know whether it can be achieved in GXT without extending of existing functionality. Maybe there are some other simpler methods to block some cells from editing depend on condition but i didn't found any. So i had to implement my own.

    First i've added method which can be overridden to my custom abstract list store
    Code:
    public boolean isCellEditable(int row,int column,T data,String fieldName)
    {
        return true;
    }
    Then i extended EditorGrid and added custom editor support which extends EditorSupport.
    In the custom editor support i overrode startEditing method and did it like this
    Code:
            @Override
            public void startEditing(int row, int col)
            {
                if (cm.isCellEditable(col))
                {
                    AbstractListStore<T> store=(AbstractListStore<T>)getStore();
                    final T data = store.getAt(row);
                    final String fieldName = cm.getDataIndex(col);
                    if(store.isCellEditable(row,col,data,fieldName))
                    {        
                        super.startEditing(row, col);
                    }
                }
            }

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Location
    Iasi, Romania
    Posts
    144

    Default

    As far as I remember, you use with editor grid another component like TextField

    and you set it like field.setEditor(myTextField)

    mb you can just enable/disable that editor .. eg myTextField.setEnabled(false) ... it's an idea at first-look

Posting Permissions

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