2014-10-23 1 views

답변

1

TreeGrid의 노드를 확장하려면 expandRow을 사용할 수 있습니다. 추가로 루프를 만들고 행의 모든 ​​부모를 확장해야합니다. 직접 부모를 얻으려면 getNodeParent을 사용할 수 있습니다. 또한 scrollrows: true 옵션을 사용하여 선택한 행으로 그리드를 스크롤해야합니다.

The resulting demo은 선택할 필요가있는 rowid로 행을 선택할 수 있습니다. "선택 행 ID로"버튼을 클릭하면 당신이 필요로하는 무엇을 : 나는 데모에 사용

enter image description here

클릭 이벤트 핸들 당신은

$("#selectId").button().click(function() { 
    var idToSelect = $("#selectedId").val(), // id of the row which need be selected 
     localRowData = $grid.jqGrid("getLocalRow", idToSelect); 

    while (localRowData.parent !== null && localRowData.parent.toUpperCase() !== "NULL") { 
     localRowData = $grid.jqGrid("getNodeParent", localRowData); 
     $grid.jqGrid("expandRow", localRowData); 
    } 

    // we use scrollrows: true option so the selection below 
    // will scroll the grid to the selected row additionally 
    $grid.jqGrid("setSelection", idToSelect); 
}); 
+0

감사 올렉 아래에 표시됩니다. 완벽하게 작동합니다. – Ali

+0

@Ali : 안녕하세요. – Oleg