2

グリッド内の 1 つの列のみを編集可能にする問題が発生しています。関連するグリッド構成は次のとおりです。

    me.FeatureGrid = me.add({
        xtype: 'rallygrid',
        width: 700,
        height:300,
        scroll:'vertical',
        columnCfgs: [
            {
                text:'Feature', 
                dataIndex:'Name',
                width:400
            },{
                text:'Stories', 
                dataIndex:'ObjectID',
                sortable:true, 
                doSort: function(direction){
                    //custom sort function
                },
                width:100,
                renderer:function(oid){
                    //custom render funciton
                }
            },{
                dataIndex:'My_Custom_Field',
                width:180,
                text:'Status',                  
                editor:{
                    xtype:'combobox',
                    store: Ext.create('Ext.data.Store', {
                        fields: ['Status'],
                        data:[
                            {'Status':'Committed'},
                            {'Status':'Not Committed'}
                        ]
                    }),
                    editable: false,
                    displayField: 'Status'
                },
                renderer: function(tcs, meta, record){
                    //render function
                }
            }
        ],
        plugins: [
            Ext.create('Ext.grid.plugin.CellEditing', {
                clicksToEdit:1
            })
        ],
        viewConfig:{
            stripeRows:true
        },
        listeners: {
            beforeedit: function(editor, e){
                console.log(e.colIdx);
                return e.colIdx === 3; //only edit last col
            },
            edit: function(editor, e){
                //edit function
            }
        },
        showPagingToolbar:false,
        enableEditing:false,
        context: this.getContext(),
        store: //feature Store
    }); 

3 番目の列 (My_Custom_Field) のみを編集可能にしようとしているため、ユーザーは列 1 と 2 を変更できません。また、3 番目の列には、選択できる値が 2 つしかないコンボボックスがあるため、それを設定する必要があります。編集不可に。私の目標は、ユーザーがコンボボックスを更新すると、「編集」イベントが発生し、更新されたレコードが保存されることです。

私の最初の問題は、行の先頭に「レコードの歯車を編集」したくないということですが、プラグインを追加したため、消えません。私が言ったように、ユーザーが編集できるのは 3 列目だけです。

また、コンボボックスをクリックして値を選択し終わると、奇妙なエラーが発生します。nullこれがエラーのスタックトレースです。グリッドに 何があるかわかりません。ここにスタックトレースがあります

4

2 に答える 2

3
  • セルを編集不可にするには、そのセルの構成に「editor:false」を追加します。
  • 歯車を非表示にするには、「showRowActionsColumn:false」をグリッド構成に追加します。
  • あなたが得ているエラーは、おそらくアイテムが編集のために適切に選択されていないという事実に関連しています. グリッドから「enableEditing:false」構成を削除してみて、それが役立つかどうかを確認してください。
于 2014-07-21T20:13:47.267 に答える