Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在extjs4中编辑时,是否需要对齐复选框、添加多条记录并查看日期字段?_Javascript_Jquery_Html_Css_Extjs4 - Fatal编程技术网

Javascript 在extjs4中编辑时,是否需要对齐复选框、添加多条记录并查看日期字段?

Javascript 在extjs4中编辑时,是否需要对齐复选框、添加多条记录并查看日期字段?,javascript,jquery,html,css,extjs4,Javascript,Jquery,Html,Css,Extjs4,我需要在网格中一次添加一个或多个记录。点击添加按钮后,我可以一次添加一条记录。但他的问题是我需要一次添加多个记录。 我尝试同时使用clickToEdit和ClickToMoveEditor,但都不起作用 编辑网格时,我需要将复选框居中对齐 this.mcmRowEditing = Ext.create('Ext.grid.plugin.RowEditing', { clicksToEdit: 1, autoCancel: true,

我需要在网格中一次添加一个或多个记录。点击添加按钮后,我可以一次添加一条记录。但他的问题是我需要一次添加多个记录。 我尝试同时使用clickToEdit和ClickToMoveEditor,但都不起作用

  • 编辑网格时,我需要将复选框居中对齐

  • this.mcmRowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
                clicksToEdit: 1,
                autoCancel: true,
                listeners: {
                    scope: this,
                    canceledit: function(editor, event) {
                        if(!editor.record.get('FocusMarketId')) { //if it was a brand new record
                            console.log("edit");
                            console.log(editor.record.get('Id'));
                            var sm = this.mcmGridPanel.getSelectionModel();
                            App.mcmFocusMarketStore.remove(sm.getSelection());
                            if(sm.getCount()) {
                                sm.select(0);
                            }
                        }
                    }
                }
    
            });
    
    
    var addFocusMarket = function(focusmarket) {
    this.mcmRowEditing.cancelEdit();
    console.log("add focus market");
    var record = new Sch.model.Resource({
    Id: focusmarket ? focusmarket.Id : '', 
    Origin: focusmarket ? focusmarket.Origin : '',
    Destination: focusmarket ? focusmarket.Destination: '',
    CabinClass: focusmarket ? focusmarket.CabinClass: '',
    StartAvailability: focusmarket ? focusmarket.startAvailability: '', 
    EndAvailability: focusmarket ? focusmarket.endAvailability: ''
    });
    console.log("records-->"+record);
    App.mcmFocusMarketStore.insert(0, record);
    this.mcmRowEditing.startEdit(0, 0);
    this.mcmHasChanges = true;
    };
    
    this.mcmGridPanel = new Ext.grid.GridPanel({
                height: 240,
                width: 540,
                title: 'Results',
                store: App.mcmFocusMarketStore,
                multiSelect: true,
                x: 0,
                y: 170,
                columns: [
                    { xtype: 'gridcolumn', text: 'Flight#', sortable: true, width: 100, dataIndex: 'FlightNumber', hidden: true, 
                        editor: {
                                xtype: 'textfield',
                                maxLength: 4,
                                minLength: 4,
                                maxChars: 4,
                        }
                    },
                    { xtype: 'gridcolumn', text: 'Origin',  sortable: true, width: 100, dataIndex: 'Origin', 
                        editor: {
                            xtype: 'textfield',
                            maxLength: 3,
                            minLength: 3,
                            maxChars: 3,
                        }
                    },  
                    { xtype: 'gridcolumn', text: 'Destination',  sortable: true, width: 100, dataIndex: 'Destination',
                        editor: {
                            xtype: 'textfield',
                            maxLength: 3,
                            minLength: 3,
                            maxChars: 3,
                        }
                    },  
                    { xtype: 'gridcolumn', text: 'Cabin',  sortable: true, width: 80, dataIndex: 'CabinClass', 
                        editor: {
                            xtype: 'textfield',
                                maxLength: 1,
                                minLength: 1,
                                maxChars: 1,
                        }
                    },
                    { xtype: 'datecolumn', text: 'Start Date', width: 100, dataIndex: 'StartAvailability', format: 'd/m/Y',
                        editor: {
                            xtype: 'datefield',
                            format: 'd/m/Y'
                        }
                    },
                    { xtype: 'datecolumn', text: 'End Date', width: 100, dataIndex: 'EndAvailability', format: 'd/m/Y', 
                        editor: {
                            xtype: 'datefield',
                            format: 'd/m/Y'
                        }
                    },
                    {
                        xtype: 'gridcolumn',
                        text: 'Delete?',
                        header: 'Delete?',
                        dataIndex: 'delete',
                        width: 60,
                        renderer: function (value, meta, record, rowIndex, colIndex) {
                            return '<center><input type="checkbox" id="Delete-' + rowIndex + '"/></center>';
                        },
                        listeners : 
                        {
                            checkchange : function(column, recordIndex, checked) 
                                        {
                                           this.mcmRemoveFocusMarket();
                                            //or send a request
                                        } 
                        },
                        handler: function() {
                           /* var sm = grid.getSelectionModel();
                            rowEditing.cancelEdit();
                            store.remove(sm.getSelection());
                            if (store.getCount() > 0) {
                                sm.select(0);
                            }*/
                        },
                        //disabled: true,
                        editor: {
                            xtype: 'checkbox'
                        }
    
                    }
                ],
                tbar: [
                    {
                        text: 'Add',
                        tooltip: 'Add Focus Market',
                        iconCls: 'icon-shift-add',
                        scope: me,
                        handler: function() {
                                addFocusMarket.call(me);
                        }
                    }
                ],
                plugins: [ this.mcmRowEditing ],
    
  • 主要的是,虽然我可以在网格中编辑,但我只能编辑除startdate和EndDate列之外的字段。它不是从数据库中呈现的
  • 如果网格的配置参数错误,有人能帮我吗

    this.mcmRowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
                clicksToEdit: 1,
                autoCancel: true,
                listeners: {
                    scope: this,
                    canceledit: function(editor, event) {
                        if(!editor.record.get('FocusMarketId')) { //if it was a brand new record
                            console.log("edit");
                            console.log(editor.record.get('Id'));
                            var sm = this.mcmGridPanel.getSelectionModel();
                            App.mcmFocusMarketStore.remove(sm.getSelection());
                            if(sm.getCount()) {
                                sm.select(0);
                            }
                        }
                    }
                }
    
            });
    
    
    var addFocusMarket = function(focusmarket) {
    this.mcmRowEditing.cancelEdit();
    console.log("add focus market");
    var record = new Sch.model.Resource({
    Id: focusmarket ? focusmarket.Id : '', 
    Origin: focusmarket ? focusmarket.Origin : '',
    Destination: focusmarket ? focusmarket.Destination: '',
    CabinClass: focusmarket ? focusmarket.CabinClass: '',
    StartAvailability: focusmarket ? focusmarket.startAvailability: '', 
    EndAvailability: focusmarket ? focusmarket.endAvailability: ''
    });
    console.log("records-->"+record);
    App.mcmFocusMarketStore.insert(0, record);
    this.mcmRowEditing.startEdit(0, 0);
    this.mcmHasChanges = true;
    };
    
    this.mcmGridPanel = new Ext.grid.GridPanel({
                height: 240,
                width: 540,
                title: 'Results',
                store: App.mcmFocusMarketStore,
                multiSelect: true,
                x: 0,
                y: 170,
                columns: [
                    { xtype: 'gridcolumn', text: 'Flight#', sortable: true, width: 100, dataIndex: 'FlightNumber', hidden: true, 
                        editor: {
                                xtype: 'textfield',
                                maxLength: 4,
                                minLength: 4,
                                maxChars: 4,
                        }
                    },
                    { xtype: 'gridcolumn', text: 'Origin',  sortable: true, width: 100, dataIndex: 'Origin', 
                        editor: {
                            xtype: 'textfield',
                            maxLength: 3,
                            minLength: 3,
                            maxChars: 3,
                        }
                    },  
                    { xtype: 'gridcolumn', text: 'Destination',  sortable: true, width: 100, dataIndex: 'Destination',
                        editor: {
                            xtype: 'textfield',
                            maxLength: 3,
                            minLength: 3,
                            maxChars: 3,
                        }
                    },  
                    { xtype: 'gridcolumn', text: 'Cabin',  sortable: true, width: 80, dataIndex: 'CabinClass', 
                        editor: {
                            xtype: 'textfield',
                                maxLength: 1,
                                minLength: 1,
                                maxChars: 1,
                        }
                    },
                    { xtype: 'datecolumn', text: 'Start Date', width: 100, dataIndex: 'StartAvailability', format: 'd/m/Y',
                        editor: {
                            xtype: 'datefield',
                            format: 'd/m/Y'
                        }
                    },
                    { xtype: 'datecolumn', text: 'End Date', width: 100, dataIndex: 'EndAvailability', format: 'd/m/Y', 
                        editor: {
                            xtype: 'datefield',
                            format: 'd/m/Y'
                        }
                    },
                    {
                        xtype: 'gridcolumn',
                        text: 'Delete?',
                        header: 'Delete?',
                        dataIndex: 'delete',
                        width: 60,
                        renderer: function (value, meta, record, rowIndex, colIndex) {
                            return '<center><input type="checkbox" id="Delete-' + rowIndex + '"/></center>';
                        },
                        listeners : 
                        {
                            checkchange : function(column, recordIndex, checked) 
                                        {
                                           this.mcmRemoveFocusMarket();
                                            //or send a request
                                        } 
                        },
                        handler: function() {
                           /* var sm = grid.getSelectionModel();
                            rowEditing.cancelEdit();
                            store.remove(sm.getSelection());
                            if (store.getCount() > 0) {
                                sm.select(0);
                            }*/
                        },
                        //disabled: true,
                        editor: {
                            xtype: 'checkbox'
                        }
    
                    }
                ],
                tbar: [
                    {
                        text: 'Add',
                        tooltip: 'Add Focus Market',
                        iconCls: 'icon-shift-add',
                        scope: me,
                        handler: function() {
                                addFocusMarket.call(me);
                        }
                    }
                ],
                plugins: [ this.mcmRowEditing ],
    
    this.mcmRowEditing=Ext.create('Ext.grid.plugin.RowEditing'{
    单击编辑:1,
    自动取消:是的,
    听众:{
    范围:本,,
    取消编辑:函数(编辑器、事件){
    如果(!editor.record.get('FocusMarketId')){//如果这是一个全新的记录
    控制台日志(“编辑”);
    console.log(editor.record.get('Id');
    var sm=this.mcmGridPanel.getSelectionModel();
    App.mcmFocusMarketStore.remove(sm.getSelection());
    if(sm.getCount()){
    sm.选择(0);
    }
    }
    }
    }
    });
    var addFocusMarket=函数(focusmarket){
    这是.mcmRowEditing.cancelEdit();
    console.log(“添加焦点市场”);
    var记录=新的Sch.model.Resource({
    Id:focusmarket?focusmarket.Id:“”,
    来源:focusmarket?focusmarket。来源:“”,
    目的地:focusmarket?focusmarket。目的地:“”,
    CabinClass:focusmarket?focusmarket.CabinClass:“”,
    StartAvailability:focusmarket?focusmarket.StartAvailability:“”,
    EndAvailability:focusmarket?focusmarket.EndAvailability:“”
    });
    日志(“记录-->”+记录);
    App.mcmFocusMarketStore.insert(0,记录);
    this.mcmRowEditing.startEdit(0,0);
    this.mchaschanges=true;
    };
    this.mcmGridPanel=新建Ext.grid.GridPanel({
    身高:240,
    宽度:540,
    标题:“结果”,
    商店:App.mcmFocusMarketStore,
    多选:对,
    x:0,,
    y:170,
    栏目:[
    {xtype:'gridcolumn',text:'Flight#',sortable:true,width:100,dataIndex:'FlightNumber',hidden:true,
    编辑:{
    xtype:'textfield',
    最大长度:4,
    最小长度:4,
    maxChars:4,
    }
    },
    {xtype:'gridcolumn',text:'Origin',sortable:true,width:100,dataIndex:'Origin',
    编辑:{
    xtype:'textfield',
    最大长度:3,
    最小长度:3,
    maxChars:3,
    }
    },  
    {xtype:'gridcolumn',text:'Destination',sortable:true,width:100,dataIndex:'Destination',
    编辑:{
    xtype:'textfield',
    最大长度:3,
    最小长度:3,
    maxChars:3,
    }
    },  
    {xtype:'gridcolumn',text:'cab',sortable:true,width:80,dataIndex:'CabinClass',
    编辑:{
    xtype:'textfield',
    最大长度:1,
    最小长度:1,
    马克沙尔斯:1,
    }
    },
    {xtype:'datecolumn',文本:'Start Date',宽度:100,数据索引:'StartAvailability',格式:'d/m/Y',
    编辑:{
    xtype:'日期字段',
    格式:“d/m/Y”
    }
    },
    {xtype:'datecolumn',text:'End Date',width:100,dataIndex:'EndAvailability',格式:'d/m/Y',
    编辑:{
    xtype:'日期字段',
    格式:“d/m/Y”
    }
    },
    {
    xtype:'gridcolumn',
    文本:“删除?”,
    标题:“删除吗?”,
    数据索引:“删除”,
    宽度:60,
    渲染器:函数(值、元、记录、行索引、共索引){
    返回“”;
    },
    听众:
    {
    checkchange:函数(列、记录索引、选中)
    {
    这是.mcremovefocusmarket();
    //或者发送请求
    } 
    },
    处理程序:函数(){
    /*var sm=grid.getSelectionModel();
    行编辑。取消编辑();
    store.remove(sm.getSelection());
    if(store.getCount()>0){
    sm.选择(0);
    }*/
    },
    //残疾人:对,,
    编辑:{
    xtype:'复选框'
    }
    }
    ],
    待定:[
    {
    文本:“添加”,
    工具提示:“添加焦点市场”,
    iconCls:“图标移位添加”,
    范围:我,
    处理程序:函数(){
    addFocusMarket.call(我);
    }
    }
    ],
    插件:[this.mcmRowEditing],
    
    1.) 不要直接将记录添加到网格中。 将数据添加到后端并重新加载网格存储,然后加载到sh