Results 1 to 2 of 2

Thread: How to set combo's options/ Store dynamically

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    180
    Answers
    1
    Vote Rating
    -7
      0  

    Default How to set combo's options/ Store dynamically

    I
    am using itscomponentcolumn in my Grid.I want to set different store for every user.If in a Grid there are 4 user's , I want to set for every user different combo store so that when user click on the Combo, he will see option's depending upon his permission, OR store that I will set.

    Code:
    var MyGrid = Ext.create('Ext.grid.Panel', {
    			id: 'ShareComponentGrId',
    			enableColumnMove:false,
    			store: store,
    	    columns: [
    		{
    			text: '<b>Name</b>',
    			flex: 1,			
    			sortable:false,
    			width: 100,
    			dataIndex: 'userName'
    		},
    		{ 
    			xtype: 'itscomponentcolumn',
    			text : '<b>Permission</b>',
    			width: 250,
    			sortable:false,
    			dataIndex: 'permission',
    			items: function(value,record) {
    			return { 
    				xtype: 'combobox',
    				store: comboStore,
    				queryMode : 'local',
    				displayField: 'display',
    				valueField: 'value',
    				name:'permission',
    				forceSelection:true,
    				width: 200,
    				listeners: {
    					afterrender: function(combo) {
    						if(record.get('isProjectOwner') || (record.get('permission')=='View Only')){
    							combo.setReadOnly(true);
    						}
    							var rec=combo.findRecordByDisplay(record.get('permission'));
    							if(rec){
    								combo.setValue(rec.get('value'));
    							}	
    					    }
    					 
    				}
    			}; 
    		} 
    	}
    suppose there is vivek user , if he has "view only" permission's then i want to show view only in the combo just next to vivek record.
    Same for other user's.
    I have tried to set the store using bindStore, but didn't work for me.
    Please suggest me how to do this ?

    ssse.JPG



  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,381
    Answers
    3997
    Vote Rating
    1536
      0  

    Default

    You should be able to execute bindStore on the combobox passing in the new store.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •