2013-07-31 2 views
0

GXT3에서 편집 - 그리드 : 버튼에 열을 추가하면 라인을 선택하면 라인이 자동으로 편집 할 수있는 편집 가능한 그리드 예에서GXT3 - 편집 가능한 그리드 : 표시 행이 팝업

에 행을 수정합니다. http://www.sencha.com/examples/#Exam...oweditablegrid

팝업에 나타나는 편집 버튼을 클릭하면 줄을 변경하고 싶습니다.

TextButtonCell button = new TextButtonCell(); 
    button.addSelectHandler(new SelectHandler() { 

     @Override 
     public void onSelect(SelectEvent event) { 
     Context c = event.getContext(); 

     Info.display("Event", "Call the popup here."); 
     } 
    }); 
    nameColumn.setCell(button); 

방법이 있나요?

미리 도움을 주셔서 감사합니다.

답변

0

우선 이미 작성한 TextBoxCell 열을 생성해야합니다. 그런 다음 grid의 편집 가능한 동작 인 onclick을 비활성화해야합니다.

Sencha 예제 파일 RowEditingGridExample.java에 따라 onClick 이벤트를 무시하고 기본 코드를 실행하지 못하도록 할 수 있습니다.

public class RowEditingGridExample extends AbstractGridEditingExample { 

    @Override 
    protected GridEditing<Plant> createGridEditing(Grid<Plant> editableGrid) { 
     return new GridRowEditing<Plant>(editableGrid){ 

     @Override 
     protected void onClick(ClickEvent event) { 
      } 
     }; 
    } 

} 

그리고 textBoxCell 클릭 핸들러를 클릭하면 수동으로 편집을 시작할 수 있습니다.

TextButtonCell button = new TextButtonCell(); 
button.addSelectHandler(new SelectHandler() { 

    @Override 
    public void onSelect(SelectEvent event) { 
    Context c = event.getContext(); 

    //Here you can pass a new GridCell like with proper cell index and row index. 

    GridCell cell = new GridCell(getRowIndex(), getCellIndex()); 
    editing.startEditng(cell); 

    } 
}); 
nameColumn.setCell(button); 

행 편집기를 별도의 팝업으로 표시하려면 수동으로 설계해야합니다.

+0

이미'GridRowEditing'을 사용하고 있다면, 자동으로 'startEditing'을 할 것입니다. (버튼을 제외하고는 클릭을 처리합니다.) - 당신이 클릭하면 버튼을 ... –

+0

@ColinAlworth Thats 왜 'onclick' 이벤트를 무시하고 그 기본 동작을 중지합니다. –

+0

좋아요, 충분하지만, 왜 모든 것을 빌드하고 질문과 같은 팝업을 만들지 않습니까? –

관련 문제