Results 1 to 2 of 2

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

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    180
    Answers
    1

    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,379
    Answers
    3997

    Default

    You should be able to execute bindStore on the combobox passing in the new store.
    Mitchell Simoens @LikelyMitch

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

    Posts are my own, not any current, past or future employer's.

Posting Permissions

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