1

我正在使用剑道 ui 网格,除更新外,一切正常。当我单击已审核的列时,该字段将更改为复选框,我可以对其进行编辑,并且会调用更新,但在 put 请求中未传递任何数据。如果我在参数映射函数中放置断点,则模型为空。Javascript代码如下:

var selfPayDataSource = new kendo.data.DataSource({
     serverFiltering: true, // <-- Do filtering server-side
     serverPaging: true, // <-- Do paging server-side
     serverSorting: true,
     autoSync: true,
     pageSize: 100,
     batch:false,
     //filter: generateDsFilter(),
     type: 'odata', // <-- Include OData style params on query string.
     sortable: {
         mode: "multiple",
         allowUnsort: true
     },
     pageable: {
         refresh: true
     },
     schema: {
         data: function (data) {
             return data.Items; // <-- The result is just the data, it doesn't need to be unpacked.
         },
         total: function (data) {
             return data["Count"]; // <-- The total items count is the data length.
         },
         model: {
             id: "SelfPayId",
             fields: {
                 resp_ind: { type: "string", editable: false },
                 cstsv_resolved: { type: "string", editable: false },
                 cstsv_rep: { type: "string", editable: false },
                 cstsv_comp_date: { type: "string", editable: false },
                 region: { type: "string", editable: false },
                 db: { type: "string", editable: false },
                 personid: { type: "string", editable: false },
                 legacyid: { type: "string", editable: false },
                 account__: { type: "string", editable: false },
                 deceased: { type: "string", editable: false },
                 patient_name: { type: "string", editable: false },
                 account_balance: { type: "number", editable: false },
                 pat_last_paid_date: { type: "date", editable: false },
                 pat_last_paid_amt: { type: "number", editable: false },
                 acct_stat: { type: "string", editable: false },
                 bill_type: { type: "string", editable: false },
                 acct_score: { type: "number", editable: false },
                 tu_status: { type: "string", editable: false },
                 scoring: { type: "number", editable: false },
                 coll_ltr: { type: "string", editable: false },
                 HighestPriPlan: { type: "string", editable: false },
                 HighestSecPlan: { type: "string", editable: false },
                 HighestTerPlan: { type: "string", editable: false },
                 Max_DOS_Aging_Group: { type: "string", editable: false },
                 Reviewed: { type: "boolean", editable: true },
                 Collector_Name: { type: "string", editable: false}
             }
         }
     },
     transport: {
         read: {
             url: "/api/SelfPayData/Get", // <-- Get data from here
             dataType: "json" // <-- The default was "jsonp"
         },
         update: {
             url: "/api/SelfPayData/PUT",
             dataType: "json", // <-- The default was "jsonp"
             contentType: "application/json; charset=utf-8",
             type: "PUT"
         },
         parameterMap: function (data, operation) {

             if (operation != "read") {

                 return JSON.stringify(data.models);
             } else {
                 var paramMap = kendo.data.transports.odata.parameterMap(data);

                 var orderBy = paramMap.$orderby;

                 if (orderBy == undefined) {
                     orderBy = "account__";
                 }else {
                     orderBy = orderBy + ",account__";
                 }

                 paramMap.$orderby = orderBy;

                 var filter = paramMap.$filter;

                 if (filter == null || filter == '') {
                     delete paramMap.$filter;
                 }

                 delete paramMap.$format; // <-- remove format parameter.

                 return paramMap;
             }
         }
     }
 });


 $(function () {
     $("#grid").kendoGrid({
         sortable: true,
         pageable: true,
         scrollable: true,
         resizable: true,
         editable: true,
         navigatable: true,
         filterable: {
             extra: false,
             operators: {
                 string: {
                     startswith: "Starts with",
                     eq: "Is equal to",
                     neq: "Is not equal to"
                 }
             }
         },
         columns: [
                   {
                       field: "cstsv_resolved",
                       title: "Cstsv Resolved",
                       width: "5em",
                       filterable: true
                   },
                   {
                       field: "cstsv_rep",
                       title: "Cstsv Rep",
                       width: "8em",
                       filterable: true
                   },
                   {
                       field: "cstsv_comp_date",
                       title: "Cstsv Comp Date",
                       width: "6em",
                       filterable: true
                   },
                   {
                       field: "region",
                       title: "Region",
                       width: "5em",
                       filterable: true
                   },
                   {
                       field: "db",
                       title: "DB",
                       width: "4em",
                       filterable: true
                   },
                   {
                       field: "personid",
                       title: "Person ID",
                       width: "6em",
                       filterable: true
                   },
                   {
                       field: "legacyid",
                       title: "Legacy ID",
                       width: "6em",
                       filterable: true
                   },
                   {
                       field: "account__",
                       title: "Account #",
                       width: "6em",
                       filterable: true
                   },
                   {
                       field: "deceased",
                       title: "Deceased",
                       width: "5.2em",
                       filterable: true
                   },
                   {
                       field: "patient_name",
                       title: "Patient Name",
                       width: "6em",
                       filterable: true
                   },
                   {
                       field: "account_balance",
                       title: "Account Balance",
                       width: "5em",
                       filterable: true,
                       format: "{0:c2}"
                   },
                   {
                       field: "pat_last_paid_date",
                       title: "Pat Last Paid Date",
                       width: "6em",
                       format: "{0: MM-dd-yyyy}",
                       filterable: true
                   },
                   {
                       field: "pat_last_paid_amt",
                       title: "Pat Last Paid Amt",
                       width: "6em",
                       filterable: true,
                       format: "{0:c2}"
                   },
                   {
                       field: "acct_stat",
                       title: "Acct Stat",
                       width: "5em",
                       filterable: true
                   },
                   {
                       field: "bill_type",
                       title: "Bill Type",
                       width: "5em",
                       filterable: true
                   },
                   {
                       field: "acct_score",
                       title: "Acct Score",
                       width: "4em",
                       filterable: true
                   },
                   {
                       field: "tu_status",
                       title: "TU Status",
                       width: "6em",
                       filterable: true
                   },
                   {
                       field: "scoring",
                       title: "Scoring",
                       width: "4em",
                       filterable: true
                   },
                   {
                       field: "coll_ltr",
                       title: "Coll Ltr",
                       width: "5em",
                       filterable: true
                   },
                   {
                       field: "HighestPriPlan",
                       title: "Pri Plan",
                       width: "5em",
                       filterable: true
                   },
                   {
                       field: "HighestSecPlan",
                       title: "Sec Plan",
                       width: "5em",
                       filterable: true
                   },
                   {
                       field: "HighestTerPlan",
                       title: "Ter Plan",
                       width: "5em",
                       filterable: true
                   },
                   {
                       field: "Max_DOS_Aging_Group",
                       title: "DOS Aging Group",
                       width: "5em",
                       filterable: true
                   },
                   {
                       field: "Reviewed",
                       title: "Reviewed",
                       width: "10em",
                       filterable: true
                   },
                    {
                        field: "Collector_Name",
                        title: "Collector Name",
                        width: "10em",
                        filterable: true
                    }
                  ],
         dataSource: selfPayDataSource
     });
 });
4

1 回答 1

2

models字段仅在batch设置为选项时可用true。这似乎不是这里的情况。当设置为时,模型字段在data参数中公开。batchfalse

于 2013-10-04T06:17:00.293 回答