상세 컨텐츠

본문 제목

jqGrid Tree

jqGrid

by 탑~! 2015. 1. 23. 20:14

본문

function treeGrid( jsonString ){
  $('#gridtable').jqGrid({
   datatype: 'jsonstring',  //---변수에 담아 사용 시 필요
   datastr: jsonString,   //---변수에 담아 사용 시 필요
   mtype: 'POST',
   loadui: 'disable',    //---이거 안 써주니 로딩 창 같은게 뜸.
   height: 'auto',
   width: 300,
   treeGridModel: 'adjacency',      //---이게 뭔지 모르겠다.
   treeGrid: true,
   ExpandColumn : 'NAME',    //---해당 컬럼에 tree처리
   ExpandColClick: true,
   tree_root_level: 0,
   treeIcons: {leaf:'ui-icon-document-b'},
   caption: "카테고리",
      colNames:[

    'ID',
    'LEVEL',
    'NAME',
    'STEP',
    '펼침여부',
    'isLeaf',
    'PSEQ'
   ],
      colModel:[
    { name : 'ID', index:'CT_SEQ', width: 1, hidden: true },
    { name : 'LEVEL', index: 'CT_LEVEL', width: 80, align: 'center' },
    { name : 'NAME', index: 'CT_NAME', width: 180 },
    { name : 'STEP', index: 'CT_STEP', width: 80, hidden: true, align: 'right' },
    { name : 'EXPANDED',index: 'CT_EXPANDED', width: 80, hidden: true, align: 'right' },
    { name : 'ISLEAF', index: 'CT_ISLEAF', width: 80, hidden: true, align: 'right' },
    { name : 'PSEQ', index: 'CT_PSEQ', width: 80, hidden: true, align: 'right' }
      ],
      jsonReader:{     // json에서 page, total, root등 필요한 정보를 어떤 키값에서 가져와야 되는지 설정하는듯.
       id : "CODE",    //--- 이 값을 기준으로 tree가 만들어 진다. 아래 parent_id_field는 이값을 참조(?)한다.
    root : 'categoryList',   // 실제 jqgrid에서 뿌려져야 할 데이터들이 있는 json 키값
    repeatitems : false           
   },
      treeReader:{
       level_field: 'LEVEL',        //---level값 

       parent_id_field : 'PSEQ',   //---부모id값 
          leaf_field: 'ISLEAF',       
          expanded_field: 'CT_EXPANDED'
      },
  });
  
 }

'jqGrid' 카테고리의 다른 글

jqGrid  (0) 2014.11.13

관련글 더보기