본문 바로가기
JQuery

[JQuery] JQGrid afterInsertRow 이벤트를 이용해 셀 값 수정

by Hwoarang757 2015. 3. 24.

[JQuery] JQGrid afterInsertRow 이벤트를 이용해 셀 값 수정 또는 합치기

 

 

 

jQuery("#tbList").jqGrid({

                datatype: "local",

                height:500,

                colNames: [“Column1”,”Column2”,”Column3”],

                colModel:

                [

                   { name: ' Column1', index: ' Column1', width: 260, align: "center" },

                   { name: ' Column2', index: ' Column2’, width: 260, align: "center" },

                   { name: ' Column3', index: ' Column3', width: 260, align: "center" },

                   ],

 

 

afterInsertRow: function (rowid, rowData, rowelem) {

//alert(rowid + "|" + rowData.InputMaterial + "|" + rowelem);

$("#" + rowid).children("td:eq(3)").text(rowData.Column1 + " " + rowData. Column2);

 

},

multiselect: false,

                autowidth: false,

                shrinkToFit: false,

                sortable: true,

                //viewrecords: true,

                caption: "테스트"

});

 

                  

 

                                                     

예제는 Column1 과 Column2의 값을 더하여 Column3에 출력하는 부분입니다.