Home  >  Article  >  Web Front-end  >  Edit jqGrid when jquery is added (example code)_jquery

Edit jqGrid when jquery is added (example code)_jquery

WBOY
WBOYOriginal
2016-05-16 17:16:511041browse

Copy code The code is as follows:

function showTestSubjectGrid() {
$("#testSubjectGrid").jqGrid({
url: "",
datatype: "json",
height: 215, Width: 480,
CAPTION: "Test subjects",
Autoheight: TRUE,
Autowidth: TRUE,
Scrollrows: False, // Whether the row rolling bar shows
multiselect: true , // Whether to display the check box Hidegrid: false, // Cancel the shrinkage of GRID
Postdata: {
STRJSON: TestsubjectData
},
collNames: ['', 'Test subjects,' Test subjects ', 'Start time', 'End time', 'Scenes', ],
                                                                                                                               : true
}, {
name: 'display_content',
index: 'display_content',
width: 100,
editable: true,
align: 'left'
                                                                                                                                           align: 'center'
}, {
name: 'exam_EndTime',
index: 'exam_EndTime',
width: 110,
editable: true,
align: ' center'
      }, {
            name : 'exam_turn',
index: 'exam_turn',
width: 110,
editable: true,
align: 'center'
}],
jsonReader: {
root: "rows",
repeatitems: false,
id: "data"
},
        gridComplete: function () {
            var testIds = $("#testSubjectGrid").jqGrid("getDataIDs");
            for (var i = 0; i < testIds.length; i ) {
                var cid = testIds[i];
                var exam_begintime = "";
                var exam_endtime = "";
                var exam_turn = "";
                jQuery("#testSubjectGrid").jqGrid('setRowData', cid, { exam_startTime: exam_begintime });
                jQuery("#testSubjectGrid").jqGrid('setRowData', cid, { exam_EndTime: exam_endtime });
                jQuery("#testSubjectGrid").jqGrid('setRowData', cid, { exam_turn: exam_turn });
                $("#exam_begintime_" testIds[i]).datepicker({
                    showOn: 'button',
                    buttonText: '选择'
                });
                $("#exam_endtime_" testIds[i]).datepicker({
                    showOn: 'button',
                    buttonText: '选择'
                });

            }
        }
    });
};

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn