Results 1 to 2 of 2

Thread: EditorGrid with different CellEditor on different row

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    1
    Vote Rating
    0
      0  

    Default EditorGrid with different CellEditor on different row

    Hi all,

    I finding a solution to read dynamic data, and use EditorGrid with different CellEditor on different row at same column for the data. Can I do that? Any ideas?

  2. #2
    Sencha User
    Join Date
    Nov 2009
    Posts
    51
    Answers
    1
    Vote Rating
    0
      0  

    Default

    I see a way to set to different editors for different rows. Here is the example that uses combo box for the one row and normal editor for the next row for the same column.

    Code:
    grid.addListener(Events.BeforeEdit, new Listener<GridEvent<Plant>>() {
    	public void handleEvent(GridEvent<Plant> be) {
    		// be.getColIndex()
    		int rowIndex = be.getRowIndex();
    		int colIndex = be.getColIndex();
    		if (colIndex == 1) {
    			if (rowIndex % 2 == 0) {
    				grid.getColumnModel().getColumn(colIndex).setEditor(editor);
    			} else {
    				grid.getColumnModel().getColumn(colIndex).setEditor(textEditor);
    			}
    		}
    
    
    	};
    });
    Although it seems to work fine, I am not sure of it has any consequences.
    Last edited by smiletolead; 7 Mar 2012 at 11:43 PM. Reason: Corrected code formatting

Posting Permissions

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