Sencha grid 신규 컬럼 여부 체크

2024. 12. 18. 21:58Javascript/Sencha

신규 row는 record.phantom=true

        {
            text: 'Age',
            dataIndex: 'age',
            flex: 1,
            renderer: function (value, metaData, record) {
                if (!record.phantom) {
                    metaData.tdCls = 'non-editable';
                }
                return value;
            },
            editor: {
                xtype: 'numberfield',
                allowBlank: false,
                minValue: 0
            },
            getEditor: function (record, defaultEditor) {
                // Allow editing only for new rows
                return record.phantom ? defaultEditor : null;
            }
        }