在编辑模式下更改特定行dojo dgrid中的文本字段属性

在编辑模式下更改特定行dojo dgrid中的文本字段属性,dojo,dgrid,Dojo,Dgrid,我想更改特定行中的文本字段属性 我有一个带有5个字段的可编辑dGrid,其中2个字段被禁用,当选择字段的值更改时,它们的值也会更改,现在我希望当选择字段的值更改为特定值时,两个禁用的字段仅对此行启用编辑,然后在选择字段中选择其他值时再次禁用,这是网格的截图 this.productStore = new Memory({idProperty: 'id', data: []}); this.productObjStore = new ObjectStore({objectStore: th

我想更改特定行中的文本字段属性

我有一个带有5个字段的可编辑dGrid,其中2个字段被禁用,当选择字段的值更改时,它们的值也会更改,现在我希望当选择字段的值更改为特定值时,两个禁用的字段仅对此行启用编辑,然后在选择字段中选择其他值时再次禁用,这是网格的截图

 this.productStore = new Memory({idProperty: 'id', data: []});
 this.productObjStore = new ObjectStore({objectStore: 
 this.productStore});
        var productColumn = {
            field: 'productServiceId', 
            label: dojoConfig.i18n.productOrService, 
            className: 'hand',
            editor: Select,
            autoSave: true,
            editorArgs: {
                searchAttr: 'name',
                labelAttr: "name",
                style: 'width: 95%',
                store: this.productObjStore,
                required: true,
            },
            renderCell: function(object, data, td, options){
                if(data != ''&& data != dojoConfig.i18n.addNewProduct){
                    td.innerHTML = this.editorArgs.store.get(data).label;
                }
            }
        };

        var quantityColumn = {
            field: 'quantity', 
            label: dojoConfig.i18n.quantity, 
            className: 'hand',
            editor: TextBox,
            autoSave: true,
            editorArgs: {
                placeHolder: '#####',
                regExp: dojoConfig.regExps.intExp,
                trim: true,
                style: 'width: 100%',
                invalidMessage: dojoConfig.i18n.error_quantityIsZero,
                validator: function(){

                    if( this.value > 0)
                        return true;

                    return false;
                }
            }
        };
        var me=this
        var rateColumn = {
                field: 'rate', 
                label: dojoConfig.i18n.rate, 
                className: 'hand',
                editor: TextBox,
                autoSave: true,
                editorArgs: {
                    disabled: true,
                    placeHolder: '#####.##',
                    regExp: dojoConfig.regExps.floatExp,
                    trim: true,
                    style: 'width: 100%',
                }
            };

        var amountColumn = {
            field: 'amount', 
            label: dojoConfig.i18n.amount, 
            className: 'hand',
            editor: TextBox,
            editorArgs: {
                disabled: true,
                placeHolder: '#####.##',
                regExp: dojoConfig.regExps.floatExp,
                trim: true,
                style: 'width: 100%',
            }
        };

        this.discountStore = new Memory({idProperty: 'id', data: []});
        var discountColumn = {
            field: 'discount', 
            label: dojoConfig.i18n.lineDiscount, 
            className: 'hand',
            editor: Select,
            autoSave: true,
            editorArgs: {
                searchAttr: 'name',
                labelAttr: "name",
                style: 'width: 99%',
                store: this.discountStore,
                required: false,
                value:null
            },
            renderCell: function(object, data, td, options){
                if(data != '')
                    td.innerHTML = this.editorArgs.store.get(data).label;
            }
        };

        this._grid = new Grid({
            autoHeight: true,
            showToolbar: true,
            //label: dojoConfig.i18n.invoiceLines,
            style: 'width: 100%; max-height: 200px; margin-top: 1px;',
            columns : [
                {field: 'id', label: 'ID', hidden: true, unhidable: true},
                productColumn,
                {field: 'description' ,label: dojoConfig.i18n.description, dismissOnEnter: false, editor: 'textarea', autoSave: true, renderCell: function(object, data, td, options){
                    td.innerHTML = data;
                }},
                quantityColumn,
                rateColumn,
            //  discountColumn,
                amountColumn,
                {field: 'taxable', style:'width:50%', label: dojoConfig.i18n.taxable, editor: CheckBox, hidden: true, unhidable: true}
            ],
            contextMenuInfo: [
                {label: dojoConfig.i18n.new_, iconClass: 'newIcon', onClick: this.addProduct},
                {label: dojoConfig.i18n.remove, iconClass: 'deleteIcon', onClick: this.deleteProduct, needSelection: true}
            ],
            contextHandler: this,
            selectionMode : 'single', // for Selection; only select a single row at a time
            cellNavigation : false,
            colspan: 5
        });
        this._grid.set('store', new Observable(new Memory({idProperty: 'id', data: []})));

下面是网格的创建

 this.productStore = new Memory({idProperty: 'id', data: []});
 this.productObjStore = new ObjectStore({objectStore: 
 this.productStore});
        var productColumn = {
            field: 'productServiceId', 
            label: dojoConfig.i18n.productOrService, 
            className: 'hand',
            editor: Select,
            autoSave: true,
            editorArgs: {
                searchAttr: 'name',
                labelAttr: "name",
                style: 'width: 95%',
                store: this.productObjStore,
                required: true,
            },
            renderCell: function(object, data, td, options){
                if(data != ''&& data != dojoConfig.i18n.addNewProduct){
                    td.innerHTML = this.editorArgs.store.get(data).label;
                }
            }
        };

        var quantityColumn = {
            field: 'quantity', 
            label: dojoConfig.i18n.quantity, 
            className: 'hand',
            editor: TextBox,
            autoSave: true,
            editorArgs: {
                placeHolder: '#####',
                regExp: dojoConfig.regExps.intExp,
                trim: true,
                style: 'width: 100%',
                invalidMessage: dojoConfig.i18n.error_quantityIsZero,
                validator: function(){

                    if( this.value > 0)
                        return true;

                    return false;
                }
            }
        };
        var me=this
        var rateColumn = {
                field: 'rate', 
                label: dojoConfig.i18n.rate, 
                className: 'hand',
                editor: TextBox,
                autoSave: true,
                editorArgs: {
                    disabled: true,
                    placeHolder: '#####.##',
                    regExp: dojoConfig.regExps.floatExp,
                    trim: true,
                    style: 'width: 100%',
                }
            };

        var amountColumn = {
            field: 'amount', 
            label: dojoConfig.i18n.amount, 
            className: 'hand',
            editor: TextBox,
            editorArgs: {
                disabled: true,
                placeHolder: '#####.##',
                regExp: dojoConfig.regExps.floatExp,
                trim: true,
                style: 'width: 100%',
            }
        };

        this.discountStore = new Memory({idProperty: 'id', data: []});
        var discountColumn = {
            field: 'discount', 
            label: dojoConfig.i18n.lineDiscount, 
            className: 'hand',
            editor: Select,
            autoSave: true,
            editorArgs: {
                searchAttr: 'name',
                labelAttr: "name",
                style: 'width: 99%',
                store: this.discountStore,
                required: false,
                value:null
            },
            renderCell: function(object, data, td, options){
                if(data != '')
                    td.innerHTML = this.editorArgs.store.get(data).label;
            }
        };

        this._grid = new Grid({
            autoHeight: true,
            showToolbar: true,
            //label: dojoConfig.i18n.invoiceLines,
            style: 'width: 100%; max-height: 200px; margin-top: 1px;',
            columns : [
                {field: 'id', label: 'ID', hidden: true, unhidable: true},
                productColumn,
                {field: 'description' ,label: dojoConfig.i18n.description, dismissOnEnter: false, editor: 'textarea', autoSave: true, renderCell: function(object, data, td, options){
                    td.innerHTML = data;
                }},
                quantityColumn,
                rateColumn,
            //  discountColumn,
                amountColumn,
                {field: 'taxable', style:'width:50%', label: dojoConfig.i18n.taxable, editor: CheckBox, hidden: true, unhidable: true}
            ],
            contextMenuInfo: [
                {label: dojoConfig.i18n.new_, iconClass: 'newIcon', onClick: this.addProduct},
                {label: dojoConfig.i18n.remove, iconClass: 'deleteIcon', onClick: this.deleteProduct, needSelection: true}
            ],
            contextHandler: this,
            selectionMode : 'single', // for Selection; only select a single row at a time
            cellNavigation : false,
            colspan: 5
        });
        this._grid.set('store', new Observable(new Memory({idProperty: 'id', data: []})));

谢谢

您尝试了什么,遇到了什么问题?您尝试了什么,遇到了什么问题?