jqgrid content-type datatype

Posted kexb

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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){
                          returnError: +data.responseText
                        }
                      },
                      addDialogOptions: {
                        "recreateForm": true,
                        errorTextFormat: function(data){
                          returnError: +data.responseText
                        }
                      },
                      delDialogOptions: {
                        errorTextFormat: function(data){
                          returnError: +data.responseText
                        }
                      },
                      searchDialogOptions: {
                        
                      },
                      viewRowDetailsDialogOptions: {
                        
                      },
                      jsonReader: {
                        id: "Id"
                      },
                      rowNum: 50,
                      rowList: [
                        50,
                        100,
                        200
                      ],
                      sortorder: asc,
                      hidegrid: false,
                      height: 400,
                      autowidth: true,
                      headertitles: true,
                      rownumbers: true,
                      shrinkToFit: false,
                      pager: jQuery(#jq2_pager),
                      viewsortcols: [
                        false,
                        vertical,
                        true
                      ],
                      loadComplete: gridComplete1,
                      ondblClickRow: jq2DoubleClick,
                      loadError: jqGrid_aspnet_loadErrorHandler
                    }
                                          
                      );

 

以上是关于jqgrid content-type datatype的主要内容,如果未能解决你的问题,请参考以下文章

ASP.NET MVC+EF在服务端分页使用jqGrid以及jquery Datatables的注意事项

jQuery Datatable,通过 UI 调整 col 宽度

JQgrid表格的使用

jqgrid 怎么获取返回的数据

jqgrid的小demo

jqgrid使用sql row_number进行分页