jqgrid 에서의 custom validation

jQuery 2011. 1. 11. 19:53
jqgrid 내에서 validation 을 처리할 경우에 내부에 정의된 옵션을 이용할 수 있다. required, 
date, url 등의 옵션을 이용하여 validation 을 처리할 수 있고 옵션을 이용하기가 어려운 custom
validation 이 필요한 경우에는 다음과 같이 만들어서 사용할 수 있다.

<script>
function mypricecheck(value, colname) {
if (value < 0 && value >20)
return [false,"Please enter value between 0 and 20"];
else
return [true,""];
}
jQuery("#grid_id").jqGrid({
...
colModel: [
...
{name:'price', ..., editrules:{custom:true, custom_func:mypricecheck....},
editable:true },
...
]
...
});
</script>
return 값이 조금은 특이하지만 이렇게 jqgrid 의 custom validation 을 처리할 수 있다.

'jQuery' 카테고리의 다른 글

Check All Checkboxes with JQuery  (0) 2011.04.14
[fullcalendar] events : function 처리  (2) 2010.11.22
[jquery] fullcalendar  (33) 2010.11.02
posted by 소연파파™