jqgrid content-type datatype

jQuery('#jq2').jqGrid(
                      {
                      url: 'http://localhost:8080/api/RskPriceFactorTest/senario/0/detail',
                      editurl: 'http://localhost:8080/api/RskPriceFactorTest/update/scenario/detail',
                      exportUrl: '/RSK/RskStressTestCaseManage2.html&jqGridID=jq2',
                       datatype: function (pdata) {
                
                               $.ajax({
                                 type: "GET",
                                 dataType:"json",
                                 url: "http://localhost:8080/api/RskPriceFactorTest/senario/"+pdata.txt_RiskStressTestCaseId_+"/detail",
                                 contentType: "application/json",
                                 data:pdata,
                                 success: function (data) {
                                   var thegrid = jQuery("#jq2")[0]
                                   thegrid.addJSONData(data); 
                                  }
                              })
                          alert("可香槟"+ JSON.stringify(pdata))
                       },
                      page: 1,
                      colNames: [
                        "编辑",
                        "风险价格因子",
                        "运算符",
                        "绝对值或百分比",
                        "币种",
                        "冲击值",
                        "时间长度",
                        "限额值",
                        "生效日期",
                        "终止日期",
                        "Id"
                      ],
                      colModel: [
                        {
                          "frozen": true,
                          "superFilterColumn": "act",
                          "summaryTpl": "{0}",
                          "name": "act",
                          "supperControlType": "input",
                          "formatter": changeOp,
                          "align": "center",
                          "index": "act",
                          "searchoptions": {
                            
                          }
                        },
                        {
                          "frozen": true,
                          "summaryTpl": "{0}",
                          "name": "indexPriceFactorName",
                          "superFilterColumn": "indexPriceFactorName",
                          "searchoptions": {
                            
                          },
                          "supperControlType": "input",
                          "index": "indexPriceFactorName"
                        },
                        {
                          "summaryTpl": "{0}",
                          "editable": true,
                          "name": "shockModeName",
                          "superFilterColumn": "shockModeName",
                          "searchoptions": {
                            
                          },
                          "supperControlType": "input",
                          "edittype": "select",
                          "editoptions": {
                            "value": "12801:加上;112803:减去;112802:乘上"
                          },
                          "index": "shockModeName"
                        },
                        {
                          "summaryTpl": "{0}",
                          "editable": true,
                          "name": "shockValueTypeName",
                          "superFilterColumn": "shockValueTypeName",
                          "searchoptions": {
                            
                          },
                          "supperControlType": "input",
                          "edittype": "select",
                          "editoptions": {
                            "value": "137001:绝对值;137002:百分比"
                          },
                          "index": "shockValueTypeName"
                        },
                        {
                          "summaryTpl": "{0}",
                          "editable": true,
                          "name": "valueCurrencyName",
                          "superFilterColumn": "valueCurrencyName",
                          "searchoptions": {
                            
                          },
                          "supperControlType": "input",
                          "edittype": "select",
                          "editoptions": {
                            "value": "EUR:欧元;CAD:加币;CNY:人民币;USD:美元;JPY:日圆;HKD:港币"
                          },
                          "index": "valueCurrencyName"
                        },
                        {
                          "summaryTpl": "{0}",
                          "editable": true,
                          "name": "shockValue",
                          "superFilterColumn": "shockValue",
                          "searchoptions": {
                            
                          },
                          "supperControlType": "input",
                          "index": "shockValue"
                        },
                        {
                          "summaryTpl": "{0}",
                          "editable": true,
                          "name": "timeHorizon",
                          "superFilterColumn": "timeHorizon",
                          "searchoptions": {
                            
                          },
                          "supperControlType": "input",
                          "index": "timeHorizon"
                        },
                        {
                          "summaryTpl": "{0}",
                          "editable": true,
                          "name": "stressTestLimitValue",
                          "superFilterColumn": "stressTestLimitValue",
                          "searchoptions": {
                            
                          },
                          "supperControlType": "input",
                          "index": "stressTestLimitValue"
                        },
                        {
                          "summaryTpl": "{0}",
                          "classes": "aa",
                          "searchoptions": {
                            
                          },
                          "name": "startDate",
                          "superFilterColumn": "startDate",
                          "formatter": getDate,
                          "supperControlType": "input",
                          "index": "startDate",
                          "editable": true
                        },
                        {
                          "summaryTpl": "{0}",
                          "classes": "aa",
                          "searchoptions": {
                            
                          },
                          "name": "endDate",
                          "superFilterColumn": "endDate",
                          "formatter": getDate,
                          "supperControlType": "input",
                          "index": "endDate",
                          "editable": true
                        },
                        {
                          "summaryTpl": "{0}",
                          "superFilterColumn": "id",
                          "name": "id",
                          "supperControlType": "input",
                          "searchoptions": {
                            "searchhidden": true
                          },
                          "hidden": true,
                          "key": true,
                          "index": "id"
                        }
                      ],
                      viewrecords: true,
                      scrollrows: false,
                      postData: $('body').GetSearchPostData(),
                      styleUI: 'Bootstrap',
                      postBackUrl: "__doPostBack('jq2','jqGridParams')",
                      editDialogOptions: {
                        "recreateForm": true,
                        errorTextFormat: function(data){
                          return'Error: '+data.responseText
                        }
                      },
                      addDialogOptions: {
                        "recreateForm": true,
                        errorTextFormat: function(data){
                          return'Error: '+data.responseText
                        }
                      },
                      delDialogOptions: {
                        errorTextFormat: function(data){
                          return'Error: '+data.responseText
                        }
                      },
                      searchDialogOptions: {
                        
                      },
                      viewRowDetailsDialogOptions: {
                        
                      },
                      jsonReader: {
                        id: "Id"
                      },
                      rowNum: 50,
                      rowList: [
                        50,
                        100,
                        200
                      ],
                      sortorder: 'asc',
                      hidegrid: false,
                      height: '400',
                      auto true,
                      headertitles: true,
                      rownumbers: true,
                      shrinkToFit: false,
                      pager: jQuery('#jq2_pager'),
                      viewsortcols: [
                        false,
                        'vertical',
                        true
                      ],
                      loadComplete: gridComplete1,
                      ondblClickRow: jq2DoubleClick,
                      loadError: jqGrid_aspnet_loadErrorHandler
                    }
                                          
                      );
原文地址:https://www.cnblogs.com/kexb/p/10441078.html