剑道网格中未添加滑块!列锁不起作用

时间:2018-11-13 09:52:55

标签: jquery asp.net-mvc kendo-ui kendo-grid kendo-asp.net-mvc

我想在我的Kendo网格列名称中添加冻结的列,并且数据存储在两个diff数据库表中,并且两个表都在动态加载。没有更多的列,所以我想冻结几个列,因此我将几个列的locked属性设置为true,但是它不起作用。我正在添加代码。请帮助我找出解决方案。

1。这是加载列名的代码:

GetGeneretedColumnsLookupCategories: function () {
    var a = false;
    return MasterObject._columnInTable.map(function (name) {
        if ((name == "Name") || (name == "Description") || (name == "LookupCategoryID")) {
            a = true;
        } else {
            a = false;
        }

        return {
            field: name,
            locked: a,
            width: 140,
            headerTemplate:
            "<div class='ColumnName' id='ver' style='cursor: pointer;' 
            title='Click to sort'>" + name + "<span class='glyphicon glyphicon- 
            arrow-up sorting' style='float:right;' id=" + name + "></span> 
            </div>"

        };
    })
},

2。这是加载数据源的代码:

setMastergridDataSource: function () {
    var getLookUpValuesURL = $("#getLookUpValuesURL").val();
    if (MasterObject._sortingParameter._sortParameter == null) {
        MasterObject._sortingParameter._sortParameter = 
        MasterObject._columnInTable[0];
    }
    $("#" + MasterObject._sortingParameter._sortParameter).css("visibility", 
     "visible");
    var weapon = MasterObject._columnInTable;
    var datasource = new kendo.data.DataSource({
        serverPaging: true,
        pageSize: 10,
        transport: {
            read: {
                url: getLookUpValuesURL,
                datatype: "json",
                cache: false,
                data: function () {
                    return {
                        tableName: MasterObject._dropDownTableSelection,
                        firstColumn: "Name",
                        sortorder: MasterObject._sortingParameter._sortOrder
                        sortBy: MasterObject._sortingParameter._sortParameter
                    };
                }
            }
        },


        schema: {    
            total: function () {
                return MasterObject._countOfTableRecords;
            }   
        },

    });
    debugger;

    $("#Mastergrid").data("kendoGrid").setDataSource(datasource);
    MasterObject._sortingParameter._sortParameter = null;
    MasterObject._sortingParameter._sortOrder = "DESC";

},

3。要注册网格

RegisterMastergrid:

function () {
    debugger;



        $("#Mastergrid").kendoGrid({
            height:550,
            sortable: false,
            reorderable: true,
            scrollable: true,
            selectable: "row",
            resizable: true,
            editable: false,

            pageable: {
                pageSizes: [10, 15, 20, 25],
                pageSize: 10
            },             

            change: function (e) {
                debugger;

                MasterObject._selectedRow = this.select().closest("tr").children("td");
            }
        });

    },

这是显示网格的方式,共有9列,但仅显示锁定的列。

0 个答案:

没有答案