#set ($associations_type_text = $CommonFunctions.getEncodedTermFromResourceBundle($currentUserId, "Demand", "demandassociations.associationtype")) #set ($associations_user_text = $CommonFunctions.getEncodedTermFromResourceBundle($currentUserId, "Demand", "demandassociaitons.user")) demandTable.isAssociationsValid = function () { demandTable.associationsGridCtrl.stopEditing(); var valid = true; return valid; } demandTable.associationsTabDisable = function(){ userEditor.disable(); } demandTable.associationsTabEnable = function(){ userEditor.enable(); } demandTable.associationUserDS = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:'ajax2/Gemini?action=demand.web.ajax.GetDemandAssociationUsersAction'}), reader: new Ext.data.JsonReader({}, [ {name: 'userId'}, {name: 'userName'} ]) }); var userEditor = new Ext.form.ComboBox({ hiddenName:'userName', hiddenId:'userId', fieldLabel: '$table_association_text', store: demandTable.associationUserDS, valueField: 'userId', displayField: 'userName', typeAhead: true, mode: 'local', listClass: 'x-combo-list-small', triggerAction: 'all', emptyText:'$emptytext_association', editable: false, selectOnFocus: true, grow: false, resizable: false, allowBlank: true }); demandTable.associationRoleRec = Ext.data.Record.create( [ {name: 'demandAssociationId'}, {name: 'roleId'}, {name: 'role', sortType: 'asUCString'}, {name: 'userId'}, {name: 'userName', sortType: 'asUCString'} ]); demandTable.associationRoleDS = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'ajax2/Gemini?action=demand.web.ajax.GetDemandAssociationTypesAction' }), reader: new Ext.data.JsonReader( {}, demandTable.associationRoleRec ), sortInfo:{field: 'role', direction: "ASC"} }); demandTable.associationsGridCtrl = new Ext.grid.EditorGridPanel({ ds: demandTable.associationRoleDS, cm: new Ext.grid.ColumnModel([ {id: 'demandAssociationId', header: '$associations_type_text', width: 330, sortable: true, dataIndex: 'role'}, {id: 'userId', header: '$associations_user_text', width: 285, sortable: true, dataIndex: 'userName', renderer: function (value, metadata, record) { var records = demandTable.associationUserDS.query( 'userId', value ); if (records && records.getCount() > 0) { record.set( 'userId', value ); return records.first().get( 'userName' ); } else { return value; } }, editor: userEditor} ]), clicksToEdit: 1, frame: false, iconCls:'icon-grid', width: 645, height: 370, autoScroll: true, renderTo: demandTable.associationsTabPanel, sm : new Ext.grid.RowSelectionModel() }); demandTable.associationsGridCtrl.on('afteredit', function() { loadFormsData(); }); demandTable.associationsTabPanel = new Ext.Panel({ width: 650, height: 371, layout: 'form', frame:true, labelAlign: 'top', waitMsgTarget: true, items: [ demandTable.associationsGridCtrl ] });