kendo grid encoded属性不起作用并在单元格中显示html内容

时间:2016-10-25 20:47:46

标签: javascript jquery kendo-ui telerik kendo-grid

我已将encoded:false属性添加到我的kendo网格列,但仍然将内容显示为HTML,我需要纯文本。 我在控制台中没有错误,还有另一个具有相同结构的网格并且工作正常。

这是我的网格结构及其数据源。

    var dataSource = new kendo.data.DataSource({
        transport: {
            read: {
                url: 'GetShoppingRequest',
                dataType: 'json',
                type: 'GET',
                contentType: 'application/json'
            },
            parameterMap: test
        },
        batch: true,
        pageSize: 20,
        schema: {
            model: {
                Id: "Id",
                fields: {
                    Id: { editable: false },
                    UserName: { editable: false },
                    Sigla: { editable: false },
                    TypeProvider: { editable: false },
                    CreationDate: { editable: false },
                    DateApprovedLeader: { editable: false },
                    DateReceptionProduct: { editable: false },
                    FlowStatus: { editable: false },
                    IdLeader: { editable: false },
                    Leader: { editable: false },
                    UserId: {},
                    Initials: { editable: false },
                    IdArea: { editable: false },
                    Area: { editable: false },
                    IdProject: { editable: false },
                    Project: { editable: false },
                    IdCurrency: { editable: false },
                    Currency: { editable: false },
                    Value: { editable: false },
                    FinishObservations: { editable: false}

                }
            }
        }

    });
    var gridShoppingConsult = $("#gridShoppingConsult").kendoGrid({
        dataSource: dataSource,
        pageable: true,
        filterable: true,
        selectable: true,
        sortable: true,
        resizable: true,
        height: 550,
        reorderable: true,
        width: 1000,
        columns: [
       { field: "Id",                   title: "<center>ID</center>", attributes: { style: "text-align: center" }, width: 60, filterable: false, template: '<a href="/Shopping/ViewShoppingRequest?IdPurchase=#=Id#">#=Id#</a>' },
       { field: "UserName", title: "<center>Creado por</center>", attributes: { style: "text-align: center" }, width: 150, filterable: { multi: true, search: true } },
       { field: "Sigla", title: "<center>Sigla</center>", attributes: { style: "text-align: center" }, width: 80, filterable: false },
       { field: "TypeProvider", title: "<center>Tipo Proveedor</center>", attributes: { style: "text-align: center" }, width: 130, filterable: false },
       { field: "DateApprovedLeader", title: "<center>Fecha <br>Preaprobación Lider</br></center>", attributes: { style: "text-align: center" }, width: 185, filterable: { multi: true, search: true } },
       { field: "DateReceptionProduct", title: "<center>Fecha <br>Recepción Producto</br></center>", attributes: { style: "text-align: center" }, width: 185, filterable: { multi: true, search: true } },
       { field: "FlowStatus", title: "<center>Estado</center>", attributes: { style: "text-align: center" }, width: 100, filterable: { multi: true, search: true } },
       { field: "Leader", title: "<center>Lider</center>", attributes: { style: "text-align: center" }, width: 100, filterable: { multi: true, search: true } },
       { field: "Initials",             title: "<center>Iniciales</center>", attributes: { style: "text-align: center" }, width: 100, filterable: { multi: true, search: true } },
       { field: "Area", title: "<center>Area</center>", attributes: { style: "text-align: center" }, width: 100, filterable: { multi: true, search: true } },
       { field: "Project", title: "<center>Codigo Proyecto</center>", attributes: { style: "text-align: center" }, width: 100, filterable: { multi: true, search: true } },
       { field: "Currency", title: "<center>Moneda</center>", attributes: { style: "text-align: center" }, width: 140, filterable: { multi: true, search: true } },
       { field: "Value", title: "<center>Valor Compra</center>", attributes: { style: "text-align: center" }, width: 180, filterable: false },
       {
           field: "FinishObservations", title: "<center>Observaciones</center>",encoded: false, attributes: { style: "text-align: center" }, width: 250, filterable: { multi: true, search: true }
       },
        ],
        columnReorder: function (e) {
            if (e.oldIndex > 10) {
                var that = this;
                setTimeout(function () {
                    that.reorderColumn(e.oldIndex, e.column);
                });
            }
        },
        editable: true
    });

0 个答案:

没有答案