[ExtJS] EditorGridPanel 에서 값 변경 시 validation 처리



ExtJS 의 EditorGridPanel 에서 입력되는 값이 공백으로 들어올 경우 반영이 되지 않도록 처리를 해야되는 경우가 발생하여서 API 문서를 확인하였으나, beforeedit 와 afteredit 이벤트는 있는데, 정작 edit 이벤트는 보이지 않았습니다.


그래서 valid 로 찾아보니 validateedit 라는 이벤트가 있었습니다.




validateedit : ( Object e )


Fires after a cell is edited, but before the value is set in the record. Return false to cancel the change. The edit event object has the following properties

grid - This grid

record - The record being edited

field - The field name being edited

value - The value being set

originalValue - The original value for the field, before the edit.

row - The grid row index

column - The grid column index

cancel - Set this to true to cancel the edit or return false from your handler.




두 번째 컬럼에 공백이 입력될 경우 edit 이벤트를 취소하는 예제는 아래와 같습니다.





ExtJS 는 정말 항상 저의 상상을 초월합니다. 개발자들을 한번 뵙고 싶다는...


댓글

가장 많이 본 글