2011-08-08 3 views
0

서버 측 유효성 검사 오류를 검사하기 위해 jqGRid의 "afterSubmit"속성을 사용하고 있습니다.jqgrid jquery 대화 상자의 오류에 대한 새 CSS 클래스를 설정하십시오.

afterSubmit: checkForErrors 

그리고 내 checkForErrors이 같은 것입니다 : (. 즉, UI 상태 오류)를

function checkForErrors(response,postdata){ 
    var success = true; 
    var message = "" 
    var json = eval('(' + response.responseText + ')'); 
    if(json.errors.length>0) { 
     success = false; 
     for(i=0; i < json.errors.length; i++) { 
      message += json.errors[i] + '<br/>'; 
     } 
    } 
    var new_id = null; 
    return [success,message,new_id]; 
} 

내가있는 jqGrid 사용하는 기본 오류 클래스/스타일을 변경할 수 있습니다 수정해야 할 유일한 것은, 내 사용자 정의 CSS 클래스. 어떻게하면 돼?

감사합니다.

+0

@Oleg : [답]에서 데모 (에서 – user620339

+0

봐 :) 사전에 감사 http://stackoverflow.com/questions/6791463/jquery-jqgrid-show- 메시지 - 편집 - 행 - 완료/6803206 # 6803206). 그게 네가 필요한거야? – Oleg

답변

0

이 시도 :

function checkForErrors(response,postdata){ 
    var success = true; 
    var message = "" 
    var json = eval('(' + response.responseText + ')'); 
    if(json.errors.length>0) { 
     success = false; 
     for(i=0; i < json.errors.length; i++) { 
      message += json.errors[i] + '<br/>'; 
     } 
    } 
    var new_id = null; 

    //Here pass the right class name instead of ".dialog" which you are using in your code 
    $(".dialog").find(".ui-state-error").removeClass("ui-state-error").addClass("newClass"); 

    return [success,message,new_id]; 
} 
관련 문제