2011-02-13 2 views
1

내가 사용자 지정 편집 컨트롤로 확인란 목록을 가지고있는 similar to this question을하고 있습니다. 차이가 나는 서버 (하드 확인 1, CHECK2, Check3와 클라이언트 코드되지에서 내 목록을 할 것입니다. jqGrid에서 custom_element에 대한 데이터를 얻기 위해 Ajax를 사용할 수 있습니까?

중 하나 열 설정 또는 custom_element에서이 작업을 수행 할 수있는 방법이 있나요 기능?

당신이 선택 항목에 대한 사용하지만 그 항목 만 (하지 사용자들)을 선택 적용 할 것 같습니다 dataUrl 재산에 비슷한해야 할 것 같다

.

어떤 제안?

답변

2
당신은 어떤 list 옵션을 사용할 수 있습니다

그리드를 초기화하는 동안 (정확히 editoptions 예정) 한 다음 서버에서로드 된 실제 데이터 값 덮어 쓰기 : 모든 도움을

$("#list").jqGrid({ 
    colModel: [ 
     {name:'MyMultiCheck',edittype:'custom', 
     editoptions:{custom_element:MultiCheckElem, 
         custom_value:MultiCheckVal,list:''} 
     } 
     ... 
    ] 
    ... 
}); 
$.ajax({ 
    url:"getMultiCheckList", 
    // any other parameters like dataType:'json', 
    // type: 'POST' (default type is 'GET') which depend on the server 
    success: function(data){ 
     // the code here depend on the format of data returned from the server 
     // in the simplest situation we have as data already the comma-separated 
     // string which we need as a value for the list parameter so we can do 
     jQuery("#list").setColProp('MyMultiCheck',{editoptions:{list:data}}); 
    } 
}); 
+1

감사합니다. 이것은 옳은 답변에 매우 가깝 습니다만, 제가 생각한 것 중 하나는 List 만 설정하면 custom_element와 custom) _value 설정이 삭제되므로 (초기화에서 whats를 반복하면) 해당 옵션을 포함시켜야합니다. 작업. – leora

관련 문제