【问题标题】:ExtJS 3 locked: true not workingExtJS 3 锁定:真的不工作
【发布时间】:2018-05-15 22:00:06
【问题描述】:

我试图在滚动时锁定第一列。 locked: trueenableautoLocking: true 不起作用。

代码 sn-p:

var fieldColumn = {
    header: 'Field Name',
    css: 'background-color:#eee;cursor:auto;',
    sortable: false,
    dataIndex: 'fieldName',
    locked: true,
    autoSizeColumn: true,
    width: 140
};

this.columns.push(fieldColumn);

Ext.apply(this, {
    cls: 'fieldgrid',
    layout: 'table',
    store: this.fieldStore,
    autoScroll: true,
    loadMask: CNQR.admin.loadMask,
    plugins: headerCategoryGroup,
    colModel: new Ext.grid.ColumnModel({
        defaults: {
            sortable: false
        },
        columns: this.columns
    }),
    selModel: selectModel,
    tbar: new Ext.Toolbar({
        ctCls: 'grayButtonToolBar  border-toolbar',
        buttons: [
            this.saveButton, this.cancelButton
        ]
    }),
    bbar: new Ext.PagingToolbar({
        store: this.fieldStore,
        pageSize: this.pageSize,
        displayInfo: true,
        beforePageText: CNQR.getMsg('bbarBeforePageText'),
        afterPageText: CNQR.getMsg('bbarAfterPageText'),
        displayMsg: CNQR.getMsg('bbarDisplayMsg'),
        emptyMsg: CNQR.getMsg('bbarNoRecordsFound')
    })
});
CNQR.admin.superclass.initComponent.apply(this, arguments);

【问题讨论】:

  • 非常确定 Ext 3 框架中不存在锁定。也许作为一个扩展。
  • 哦,好吧。谢谢回复。 @Evan Trimboli 如果在 ext 3 中无法使用锁定来固定列,我们是否有任何替代解决方案。
  • 下面的链接告诉它可用,我在这里遗漏了什么。我是 extJS 的新手,所以请帮助理解我是否正在寻找正确的东西。
  • jsfiddle.net/uzairpm/7F6nS 这会帮助你

标签: extjs extjs3


【解决方案1】:

更详细的答案在这里试试这个

    var fieldColumn = {
    header: 'Field Name',
    css: 'background-color:#eee;cursor:auto;',
    sortable: false,
    dataIndex: 'fieldName',
    locked: true,
    autoSizeColumn: true,
    width: 140
};

this.columns.push(fieldColumn);

Ext.apply(this, {
    cls: 'fieldgrid',
    layout: 'table',
    store: this.fieldStore,
    autoScroll: true,
    loadMask: CNQR.admin.loadMask,
    plugins: headerCategoryGroup,
    view: new Ext.ux.grid.LockingGridView(),
    colModel: new Ext.ux.grid.LockingColumnModel({
        defaults: {
            sortable: false
        },
        columns: this.columns
    }),
    selModel: selectModel,
    tbar: new Ext.Toolbar({
        ctCls: 'grayButtonToolBar  border-toolbar',
        buttons: [
            this.saveButton, this.cancelButton
        ]
    }),
    bbar: new Ext.PagingToolbar({
        store: this.fieldStore,
        pageSize: this.pageSize,
        displayInfo: true,
        beforePageText: CNQR.getMsg('bbarBeforePageText'),
        afterPageText: CNQR.getMsg('bbarAfterPageText'),
        displayMsg: CNQR.getMsg('bbarDisplayMsg'),
        emptyMsg: CNQR.getMsg('bbarNoRecordsFound')
    })
});
CNQR.admin.superclass.initComponent.apply(this, arguments);

【讨论】:

  • 非常感谢 Praveen 和 Evan。我会尝试更新你的 praveen。抱歉回复晚了。
  • 这两行不起作用。 view:new Ext.ux.grid.LockingGridView(), colModel: new Ext.ux.grid.LockingColumnModel
  • 这些是 extjs 源代码路径中可用的插件。在继续之前确保它们可用 .. 请参阅文件源文件 jsfiddle.net/uzairpm/7F6nS 的小提琴
猜你喜欢
  • 2023-03-08
  • 2011-10-17
  • 2018-04-04
  • 1970-01-01
  • 2012-06-26
  • 1970-01-01
  • 2012-07-31
  • 2023-04-06
  • 2016-08-17
相关资源
最近更新 更多