Threaded View

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    4
    Vote Rating
    0
    Karthi127 is on a distinguished road

      0  

    Default ComboBox is not editable in Grid

    ComboBox is not editable in Grid


    Hi,

    I am new to ExtJS, currently I am working on creating editable grid. There is a column with combobox which is not editable when i am adding new row to the grid, please help me to make it editable. Below is the code I am using to create editable Grid. Thanks for the help.

    Code:
     Ext.require([
                    'Ext.data.*',
                    'Ext.grid.*',
                    'Ext.toolbar.Paging',                
                    'Ext.Util.*',
                    'Ext.picker.*',
                    'Ext.window.*',
                    'Ext.tip.*',
                    'Ext.form.*',
                    'Ext.EventObject',
                    'Ext.data.StoreManager',
                    'Ext.util.DelayedTask',
                    'Ext.view.BoundList',
                    'Ext.view.BoundListKeyNav'
                ]);
    
    
        
                Ext.onReady(pageInitialize);
                
                function pageInitialize(){
                    
                    
                    Ext.define('HedgeModel',{
                        extend:'Ext.data.Model',
                        fields:[
                            {name:'accountsubtype',type:"string"},
                            {name:'accountNumber',type:"string"}
                        ]
                    });
                    
                     hedgeStore=Ext.create('Ext.data.Store',{
                        model:'HedgeModel',
                        storeId:'HedgeStore'
                    });
                    
                    var cellEditing=Ext.create('Ext.grid.plugin.CellEditing',{
                        clicksToEdit:1
                    });
                    
                    
                    
                   var grid=Ext.create('Ext.grid.Panel',{
                       store:hedgeStore,
                       columns: [{
                               header:'Account Type',
                               dataIndex:'accountsubtype',
                               width:130,
                               editor: new Ext.form.field.ComboBox({
                                   typeAhead:true,
                                   triggerAction:'all',
                                   editable:true,
                                   selectOnTab:true,
                                   store:['Shade','Share'],
                                      
                                   
                                   lazyRender:true,
                                   listClass:'x-combo-list-small'
                               })
                       },{
                            id:'accountNum',
                            header:'Account Number',
                            dataIndex:'accountNumber',
                            flex:1,
                            editor:{
                                allowBlank:false
                            }
                       },{
                           xtype:'actioncolumn',
                           width:30,
                           sortable:false,
                           items:[{
                                   icon:'../resources/images/delete.png',
                                   tooltip:'Delete Row',
                                   handler: function(grid,rowIndex,colIndex)
                                   {
                                       hedgeStore.removeAt(rowIndex);
                                   }
                           }]
                       }],
                       selModel:{
                                selType:'cellmodel'
                       },
                       renderTo:'resultGrid',
                       width:600,
                       height:300,
                       title:'Add Accounts To This Template',
                       frame:true,
                       tbar:[{
                           text:'Add Account',
                           handler: function(){
                               alert("Function Started");
                               var r=Ext.create('HedgeModel',{
                                   accountsubtype:'Share',
                                   accountNumber:''
                               });
                               alert("Record created");
                               hedgeStore.insert(0,r);
                               alert("Record inserted");
                               cellEditing.startEditByPosition({row:0,column:0});
                           }
                       }],
                   plugins:[cellEditing]
                   }); 
                   
                  
                    
                }
    Last edited by scottmartin; 8 Oct 2012 at 10:00 AM. Reason: Please format code

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar