본문 바로가기
JQuery

[JQuery] JQGrid ColModels, ColNames 동적 바인딩 간단한 예제

by Hwoarang757 2015. 6. 30.

 // 동적으로 ColNames , ColModels 를 JSON 타입으로 Array에 Push

 

function GridSettingTest()

{

 

     var colNames = [];

     var colModels = [];

       

 

     colNames.push(컬럼1,컬럼2,컬럼3,컬럼4);

     colModels.push({ name: data1, index: data1, sortable: false, frozen: true });

 

     GridSettingTest(colNames, colModels);( 잘못된 내용 )

 

GridTest(colNames, colModels);

 

}

 // JQGrid 초기화

function GridTest(colName, colModels) {

                            jQuery("#tbList").jqGrid({

                                datatype: "local",

                                colNames: colName,

                                colModel: colModels,

                                onCellSelect: function (rowid, iCol, cellcontent) {

                 

                                },

 

                                rowNum:10,

                                viewrecords: true,

                                shrinkToFit: false,

                                    height: "auto",

       

                            });

                               

}