본문 바로가기
프로그래밍/jqgrid

jqgrid tree 예제,,,

by RPoint 2012. 9. 3.

쿼리 

계층구조 쿼리 

  select * from (SELECT 

          ID 

          , NAME

          , LV

          , DECODE(  LV , 0 ,'',PARENT_ID) PT

          , decode( (select count(1) from Table   where   PARENT_ID =A.CLASS_ID) , 0 

         , 'true'

         , 'false') LF

          ,  'false' EX

           FROM Table  A  )

           START with LV =0

           connect by PRIOR ID =  PT


js /-----------------------

jQuery(document).ready(function()

{

// 리스트

jQuery("#tableList1").jqGrid({

datatype: "json",

height: 390,

width: 'auto',

  colNames:['CLASS_ID','CLASS_NAME','PT','LF'],

  colModel:[

  {name:'ID' , width:100, hidden:true, key:true , sortable:false },

  {name:'NAME' ,width:300 },

  {name:'PT' , hidden:true },

  {name:'LF' , hidden:true },

 

  ],  

 

   treeReader: {

            level_field:        "LV",

            parent_id_field:    "PT",

            leaf_field:            "LF",

            expanded_field:        "EX"

        },

        jsonReader: {

            repeatitems: false,

            id: "CLASS_ID",

            root: function(obj) { return obj["result"]["records"]; },

            page: function(obj) { return 1; },

            total: function(obj) { return 1; },

            records: function(obj) { return obj["result"]["records"].length; }

        },

        onSelectRow: function(id)

{

if(id && id!==lastsel1)

       { 

lastsel1=id;

jQuery('#tableList1').jqGrid('restoreRow',lastsel1);

        var ret = jQuery("#tableList1").getRowData(id);

        onClick_tableList1(ret);

       

        //alert(11)

       }


},

        ondblClickRow: function(id) {

       

       

jQuery('#tableList1').jqGrid('restoreRow',lastsel1);

        var ret = jQuery("#tableList1").getRowData(id);

        setSelected(ret);

       

},

        ExpandColumn: 'NAME',

        ExpandColClick: true,

        treeGridModel: 'adjacency',  //nested

       

        treeGrid: true,

      //  caption: "Tree Grid Example",

        tree_root_level: 0,

      

        

});


// $(".ui-jqgrid-hbox").hide()

});

'프로그래밍 > jqgrid' 카테고리의 다른 글

jq그리드 속성 변경  (0) 2012.09.12
jqgrid 셀 이벤트  (0) 2012.09.07
jqgrid - 체크 박스  (0) 2012.09.07
jqgrid 리스트 만들기  (0) 2012.09.03
jqgrid 마지막 row 추가  (0) 2012.09.03
jqgrid row 수정  (0) 2012.09.03
jqgird 그리드 row 삽입 - 중간에 삽입  (0) 2012.09.03
jqgrid - treegrid 예제...  (1) 2012.08.29

댓글