#set ($question_tag = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.tag")) #set ($question_name = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.name")) #set ($question_label = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.label")) #set ($question_instructions = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.instructions")) #set ($question_resp_type = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.resptype")) #set ($question_summary_type = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.summarytype")) #set ($question_table_title = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.title")) #set ($question_required = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.required")) #set ($question_reqmsg = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.requiredmsg")) #set ($question_formatcurrency = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.formatcurrency")) #set ($question_forms = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.forms")) #set ($question_access = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.access")) #set ($question_refresh = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.refresh")) #set ($question_refreshmsg = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.refreshmsg")) #set ($question_add = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.add")) #set ($question_addmsg = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.addmsg")) #set ($question_deletemsg = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.deletemsg")) #set ($question_addquestiontitle = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.addquestiontitle")) #set ($question_save = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.save")) #set ($question_savecopy = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.savecopy")) #set ($question_cancel = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.cancel")) #set ($question_delete = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.delete")) #set ($deletemsg = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.deletemsg")) #set ($delete_question_title = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.delete.title")) #set ($delete_question_message = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.delete.message")) #set ($resptypechngwarning = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.responsetypechangewarning")) #set ($savemsg = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.savemsg")) #set ($access_public = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.publicaccess")) #set ($access_sensitive = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.sensitiveaccess")) #set ($addquestion = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.addquestiontitle")) #set ($editquestion = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.editquestiontitle")) #set ($emptytextresptype = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.emptytextresponsetype")) #set ($emptytextaccess = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.emptytextaccess")) #set ($error = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.error")) #set ($choice_label = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.choicelabel")) #set ($score_label = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.scorelabel")) #set ($icon_label = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.iconlabel")) #set ($addresponse = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.addresponse")) #set ($removeresponse = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.removeresponse")) #set ($addresponsetooltip = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.addresponsetooltip")) #set ($removeresponsetooltip = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.removeresponsetooltip")) #set ($responsetitle = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.responsetitle")) #set ($blankchoicemsg = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.blankchoicemsg")); #set ($warningmsg = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.warning")); #set ($yes_text = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.yes")); #set ($no_text = $CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demandquestions.no")); var QUESTION_LOAD_ALL = "QUESTION_LOAD_ALL"; var QUESTION_LOAD = "QUESTION_LOAD"; var QUESTION_SAVE = "QUESTION_SAVE"; var QUESTION_DELETE = "QUESTION_DELETE"; var DIALOG_STATE_NEW = 'NEW'; var DIALOG_STATE_EDIT = 'EDIT'; function changeResponseType( val){ if(val == "000000000001"){ var f = questionTable.formCtrl.form.findField('isFormat'); f.container.up('div.x-form-item').setVisible(true); questionTable.gridpanel.setVisible(false); questionTable.detailDialog.setWidth(500); questionTable.detailDialog.setHeight(325); } else if((val == "000000000007") || (val == "000000000008")) { questionTable.gridpanel.setVisible(true); var f = questionTable.formCtrl.form.findField('isFormat'); f.container.up('div.x-form-item').setVisible(false); /*var respGrid = []; respGrid[0] = questionTable.formCtrl.form.findField('grid'); respGrid[0].setTitle('$responsetitle');*/ questionTable.gridpanel.setTitle('$responsetitle'); questionTable.detailDialog.setWidth(500); questionTable.detailDialog.setHeight(510); } else { var f = questionTable.formCtrl.form.findField('isFormat'); f.container.up('div.x-form-item').setVisible(false); questionTable.gridpanel.setVisible(false); questionTable.detailDialog.setWidth(500); questionTable.detailDialog.setHeight(325); } } Ext.namespace('Ext.gemini'); Ext.gemini.types = [ #set ($count = 1) #foreach ($respType in $respTypes) ['$respType.getResponseTypeId()', '$CommonFunctions.displayTermFromResourceBundle($currentUserId,"Demand","demand.resptype.$respType.getResponseTypeId()")']#if ($count < $respTypes.size()),#end #set ($count = $count + 1) #end ]; var questionTable = { detailDialog : null, addButton : null, removeButton : null, refreshButton : null, formCtrl : null, ds : null, gridCtrl : null, toolbar : null, editors: null, isLoaded : false, respTypeCombo: null, init : function() { Ext.QuickTips.init(); var ds = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:'ajax2/Gemini?action=demand.web.ajax.GetAllQuestionsAction'}), reader: new Ext.data.JsonReader( { sortField: 'sortField', sortDirection: 'sortDirection', warningMsg: 'warningMsg', root: 'rows' }, [ {name: 'questionId'}, {name: 'tag', sortType:'asUCString'}, {name: 'question', sortType:'asUCString'}, {name: 'respType'}, {name: 'respTypeId'}, {name: 'instructions'}, {name: 'required'}, {name: 'formNames'}, {name: 'required'}, {name: 'format'}, {name: 'warningMsg'} ]), sortInfo:{field: 'question', direction: "ASC"} }); //data store for response type var respTypeDS = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:'ajax2/Gemini?action=demand.web.ajax.ShowEditDemandQuestionPropertyAction'}), reader: new Ext.data.JsonReader({}, [ {name: 'propertyId'}, {name: 'choice'}, {name: 'score'}, {name: 'icon'} ]), sortInfo:{field: 'choice', direction: "ASC"} }); ds.on('load', function(store, records, options){ questionTable.ds.sort( store.reader.jsonData.sortField, store.reader.jsonData.sortDirection ); if (store.reader.jsonData.warningMsg.length > 0) { Ext.MessageBox.show({ title: '$error', msg: store.reader.jsonData.warningMsg, icon: Ext.MessageBox.ERROR, buttons: Ext.MessageBox.OK }); } }); ds.load({waitMsg:'$loadmsg'}); ds.on('loadexception', function(proxy, data, response, e) { if (store.reader.jsonData.warningMsg.length > 0) { Ext.MessageBox.show({ title: '$warningmsg', msg: store.reader.jsonData.warningMsg, icon: Ext.MessageBox.WARNING, buttons: Ext.MessageBox.OK }); } }); respTypeDS.on('load', function(store, records, options){ if (records.length > 0) { var errorMsg = records[records.length-1].get('warningMsg'); if ((errorMsg != null) && (errorMsg.length > 0)) { store.remove(records[records.length-1]); Ext.MessageBox.show({ title: 'Warning', msg: errorMsg, icon: Ext.MessageBox.WARNING, buttons: Ext.MessageBox.OK }); } } }); respTypeDS.on('loadexception', function(proxy, data, response, e) { Ext.MessageBox.show({ title: 'Error', msg: arg.responseText, buttons: Ext.MessageBox.OK }); }); questionTable.respTypeDS = respTypeDS; questionTable.ds = ds; var xg = Ext.grid; // row expander var expander = new xg.RowExpander({ tpl : new Ext.Template( '

$question_instructions: {instructions}
' ) }); questionTable.addResponse = new Ext.Button({text:'$addresponse', id:'addResponse', tooltip:'$addresponsetooltip', iconCls: 'add'}); questionTable.removeResponse = new Ext.Button({text:'$removeresponse', tooltip:'$removeresponsetooltip', iconCls: 'remove'}); //choices for multiple choice response type questionTable.choices = Ext.data.Record.create( [ {name: 'choice'}, {name: 'score', type: 'float'}, {name: 'icon'} ]); // create editors for each column var editors = []; editors[0] = new Ext.form.TextField({allowBlank:false, selectOnFocus: true // maxLength : 10 }); editors[1] = new Ext.form.NumberField({allowBlank:true, selectOnFocus: true, maxLength : 10 }); editors[2] = new Ext.form.NumberField({allowBlank:true, selectOnFocus: true, maxLength : 10 }); questionTable.editors = editors; //multiple choice response grid questionTable.gridpanel = new Ext.grid.EditorGridPanel({ store: respTypeDS, id: 'choicegrid', columns: [ {id:'choice',header: '$choice_label', width:65, sortable: true, dataIndex: 'choice', editor: editors[0]}, {header: '$score_label', width: 60, sortable: true, dataIndex: 'score', editor: editors[1]}//, // {header: '$icon_label', width: 60, sortable: true, dataIndex: 'icon', editor: editors[2]} ], tbar : [ '->',questionTable.addResponse, {xtype: 'tbseparator'}, questionTable.removeResponse], clicksToEdit: 1, stripeRows: false, autoExpandColumn: 'choice', height:160, width:460, frame: true, border: true, bodyBorder: true, layout: 'fit', title: '$responsetitle', sm : new Ext.grid.RowSelectionModel() }); questionTable.addResponse.on('click', function() { var records = new Array(1); records[0] = new questionTable.choices({ propertyId: '', choice: '', score: 0, icon: '' }); respTypeDS.add(records); questionTable.gridpanel.startEditing( respTypeDS.getCount()-1, 0 ); }); questionTable.removeResponse.on('click', function() { var selected = questionTable.gridpanel.getSelectionModel().getSelected(); if (selected) { respTypeDS.remove(selected); } }); questionTable.gridCtrl = new xg.GridPanel({ ds: ds, autoExpandColumn: 'question', cm: new xg.ColumnModel([ expander, {header: '$question_tag', width: 40, sortable: true, dataIndex: 'tag'}, {id:'question',header: '$question_name', width: 100, sortable: true, dataIndex: 'question',renderer: this.containerName },/*function (v,p) { p.attr = 'ext:qtip="' + v + '"'; return v; }},*/ {header: '$question_resp_type', width: 100, sortable: true, dataIndex: 'respType'}, {header: '$question_required', width: 70, sortable: true, dataIndex: 'required', renderer: this.containerName2}, {header: '$question_forms', width: 130, sortable: true, dataIndex: 'formNames'} ]), loadMask: {msg:'$loadmsg'}, frame:false, collapsible: false, animCollapse: false, tbar:[], title:'$question_table_title', layout:'fit', headerAsText:true, renderTo: document.body, enableHdMenu: false, plugins: expander, sm : new Ext.grid.RowSelectionModel() }); questionTable.gridCtrl.on('sortchange', function(grid, sortInfo){ Ext.Ajax.request({ url : 'ajax2/Gemini?action=common.admin.user.web.ajax.SaveUserSettingsAction', params : {start:0, limit:25, viewId: 'demandQuestionList', key: 'sort', value: sortInfo.field+","+sortInfo.direction}}); }); questionTable.addButton = new Ext.Toolbar.Button({ text:'$question_add', tooltip:'$question_addmsg', id: 'addQuestion', iconCls:'add' }); questionTable.refreshButton = new Ext.Toolbar.Button({ text:'$question_refresh', tooltip:'$question_refreshmsg', id: 'refreshQuestion', iconCls:'refresh' }); questionTable.deleteButton = new Ext.Toolbar.Button({ text:'$question_delete', tooltip:'$question_deletemsg', id: 'deleteQuestion', iconCls:'remove' }); questionTable.toolbar = questionTable.gridCtrl.getTopToolbar(); questionTable.refreshButton.on('click', function(){ questionTable.ds.reload({ waitMsg:'$deletemsg', params:{subaction:''} }); }); questionTable.deleteButton.on('click', function(){ var selections = questionTable.gridCtrl.getSelectionModel().getSelections(); if (selections.length) { Ext.MessageBox.show({ title: '$delete_question_title', msg:'$delete_question_message', buttons: Ext.MessageBox.YESNO, icon: Ext.MessageBox.QUESTION, fn: function(btn){ if( btn == "yes"){ var ids = ""; for (i = 0; i < selections.length; i++) { var record = selections[i]; if (ids != "") { ids += ","; } ids += record.data.questionId; } questionTable.deleteQuestions( ids ); } } }); } }); questionTable.addButton.on('click', function(){ questionTable.detailDialog.state = DIALOG_STATE_NEW; questionTable.formCtrl.buttons[1].hide(); //hide the check box for 'format as currency' when the form loads var f = questionTable.formCtrl.form.findField('isFormat'); f.container.up('div.x-form-item').hide(); //hide the grid for multiple choice response types when the form loads questionTable.gridpanel.hide(); questionTable.formCtrl.form.reset(); questionTable.respTypeDS.removeAll(); questionTable.detailDialog.show(questionTable.addButton.getEl()); questionTable.detailDialog.setTitle('$addquestion'); questionTable.detailDialog.setWidth(500); questionTable.detailDialog.setHeight(280); }); questionTable.toolbar.add('->'); questionTable.toolbar.add(questionTable.addButton); questionTable.toolbar.add(questionTable.deleteButton); questionTable.toolbar.add(questionTable.refreshButton); var respTypeCombo = new Ext.form.ComboBox({ id: 'respType', fieldLabel: '$question_resp_type', hiddenName:'respTypeId', store: new Ext.data.SimpleStore({ fields: ['respTypeId', 'respTypeName'], data : Ext.gemini.types }), valueField:'respTypeId', displayField:'respTypeName', typeAhead: true, mode: 'local', triggerAction: 'all', emptyText:'$emptytextresptype', editable: false, selectOnFocus:true, grow: false, resizable:false, width:330, maxHeight: 150, allowBlank:false }); questionTable.respTypeCombo = respTypeCombo respTypeCombo.on('select', function(val){ var value = val.getValue(); changeResponseType(value); //Call the function to change the response type questions }) var requiredchkbox = new Ext.form.Checkbox({ fieldLabel: '', hideLabel : true, name: 'required', value: 'off', width: 400, height: 30, id: 'isRequired', boxLabel: '$question_reqmsg' }); var isFormatChkBox = new Ext.form.Checkbox({ //fieldLabel: '', hideLabel : true, name: 'isFormat', id: 'isFormat', value: 'off', width: 400, boxLabel: '$question_formatcurrency' }); var isRequired = 'N'; requiredchkbox.on('check', function(val){ if(val.getValue()== true) isRequired = 'Y'; else isRequired = 'N'; }); var isFormat= ''; isFormatChkBox.on('check', function(val){ if(val.getValue() == true) isFormat = 'C'; else isFormat = ''; }); questionTable.formCtrl = new Ext.FormPanel({ labelWidth: 120, frame:true, buttonAlign: 'right', labelAlign: 'right', defaultType: 'textfield', //defaults: {width: 330}, waitMsgTarget: true, reader: new Ext.data.JsonReader({id: "id"}, ['questionId', 'question', 'instructions', 'respTypeId', 'respTypeName', 'tag']), items: [ { xtype:'hidden', name:'questionId', id:'questionId', width: 330 }, { xtype:'textarea', fieldLabel: '$question_label', maxLength: $DemandQuestionMetaInfo.getColumnWidth("Question"), name: 'question', id:'question', allowBlank: false, width: 330 }, { xtype:'textarea', fieldLabel: '$question_instructions', name: 'instructions', maxLength: $DemandQuestionMetaInfo.getColumnWidth("Instructions"), id:'instructions', allowBlank: true, width: 330 }, respTypeCombo, isFormatChkBox, { xtype:'textfield', fieldLabel: '$question_tag', name: 'tag', maxLength: $DemandQuestionMetaInfo.getColumnWidth("Tag"), id: 'tag', allowBlank: true, width: 330 }, requiredchkbox, questionTable.gridpanel, { xtype:'hidden', name:'origRespTypeId', id:'origRespTypeId', width: 330 } ], buttons:[ { text: '$question_save', id: 'saveQuestion', handler: function(){ var choices =[]; var dstore = respTypeDS; var storeCount = dstore.getCount(); var blankChoice = false; var count = 0; for (var i = 0;i < storeCount;i++) { choice = dstore.getAt(i); choices[i] = { 'propertyId' : choice.get('propertyId'), 'choice': choice.get('choice'), 'score': choice.get('score'), //'icon': choice.get('icon') //hardcode it for now 'icon' : ' ' }; //if the choice is blank, give a warning message saying this is required if(choice.get('choice').replace(/^\s+|\s+$/g, '')==''){ blankChoice = true; count = i; break; } } if(blankChoice){ questionTable.gridpanel.startEditing( count, 0 ); } else { var origRespTypeId = questionTable.formCtrl.findById('origRespTypeId').getValue(); var newRespTypeId = questionTable.formCtrl.findById('respType').getValue(); var noChange = ""; if(origRespTypeId != newRespTypeId) noChange = "false"; //if the response type changes from either boolean, date or numeric to text(single or multi), do not give the warning msg if((origRespTypeId == "000000000001") && ((newRespTypeId == "000000000003") ||(newRespTypeId == "000000000004"))){ noChange = "true"; } else if((origRespTypeId == "000000000002") && ((newRespTypeId == "000000000003") ||(newRespTypeId == "000000000004"))){ noChange = "true"; } else if((origRespTypeId == "000000000005") && ((newRespTypeId == "000000000003") ||(newRespTypeId == "000000000004"))){ noChange = "true"; } //if the response type changes from single textto multi text, do not give the warning msg else if((origRespTypeId == "000000000003") && (newRespTypeId == "000000000004")){ noChange = "true"; } //if the response type changes multi choice single answer to multichoice multi answer, do not give the warning msg else if((origRespTypeId == "000000000007") && (newRespTypeId == "000000000008")){ noChange = "true"; } //give the warning message only if the original response type is different from the new one. if ((origRespTypeId.length > 0)&&(noChange == "false")){ Ext.MessageBox.show({ title: '$warningmsg', msg:'$resptypechngwarning', buttons: Ext.MessageBox.YESNO, fn: function(btn){ if( btn == "yes"){ var questionId = questionTable.formCtrl.findById('questionId').getValue(); questionTable.formCtrl.form.submit({url:'ajax2/Gemini?action=demand.web.ajax.SaveDemandQuestionAction', waitMsg:'$savemsg', params:{questionId:questionId, choices: Ext.util.JSON.encode(choices), required: isRequired, format: isFormat}, success:function(form, action) { questionTable.detailDialog.hide(); questionTable.ds.load({waitMsg:'$loadmsg'}); }, failure:function(form, action) { if (action.result){ Ext.MessageBox.show({ title: '$error', msg: action.result.data[0].msg, buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.ERROR }); } } }); } } }); } else{ var questionId = questionTable.formCtrl.findById('questionId').getValue(); questionTable.formCtrl.form.submit({url:'ajax2/Gemini?action=demand.web.ajax.SaveDemandQuestionAction', waitMsg:'$savemsg', params:{questionId:questionId, choices: Ext.util.JSON.encode(choices), required: isRequired, format: isFormat}, success:function(form, action) { questionTable.detailDialog.hide(); questionTable.ds.load({waitMsg:'$loadmsg'}); }, failure:function(form, action) { if (action.result){ Ext.MessageBox.show({ title: '$error', msg: action.result.data[0].msg, buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.ERROR }); } } }); } } } }, { text: '$question_savecopy', handler: function(){ questionTable.formCtrl.form.submit({url:'ajax2/Gemini?action=demand.web.ajax.SaveDemandQuestionAction', waitMsg:'$savemsg', params:{questionId:'$questionId'}, success:function(form, action) { questionTable.detailDialog.hide(); questionTable.ds.load({waitMsg:'$loadmsg',params:{start:0, limit:25}}); }, failure:function(form, action) { if (action.result) { Ext.MessageBox.show({ title: '$error', msg: action.result.data[0].msg, buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.ERROR }); } } }); } }, { text: '$question_cancel', handler: function() { questionTable.detailDialog.hide(); } } ] }); if(!questionTable.detailDialog){ questionTable.detailDialog = new Ext.Window({ id: 'questionDetailDialog', title: '$addquestion', state: DIALOG_STATE_NEW, width:500, height:300, closeAction:'hide', plain: true, items: questionTable.formCtrl, modal: true, resizable : false, renderTo: document.body }); }; }, containerName : function(value, metadata, record, rowindex, colindex, store){ // v,p) { var title = value; var id = questionTable.ds.getAt(rowindex).get('questionId'); var respTypeId = questionTable.ds.getAt(rowindex).get('respTypeId'); var format = questionTable.ds.getAt(rowindex).get('format'); var required = questionTable.ds.getAt(rowindex).get('required'); return "

" + title + "
"; }, containerName2 : function(value, metadata, record, rowindex, colindex, store){ // v,p) { var required = questionTable.ds.getAt(rowindex).get('required'); if(required == "Y") return "$yes_text"; else return "$no_text"; }, deleteQuestions : function (ids) { questionTable.ds.reload({ waitMsg:'$deletemsg', params:{idList:ids, subaction:'DELETE'} }); }, showQuestionDetails : function(id) { questionTable.detailDialog.state = DIALOG_STATE_EDIT; questionTable.formCtrl.buttons[1].hide(); questionTable.formCtrl.form.reset(); questionTable.detailDialog.show(questionTable.addButton.getEl()); questionTable.detailDialog.setTitle('$editquestion'); var f = questionTable.formCtrl.form.findField('isFormat'); f.container.up('div.x-form-item').setVisible(false); questionTable.gridpanel.setVisible(false); //var ids=[]; var ids = id.split(","); id= ids[0]; respTypeId = ids[1]; format = ids[2]; required = ids[3]; questionTable.formCtrl.form.findField('origRespTypeId').setValue(respTypeId); if(required == "Y") questionTable.formCtrl.form.findField('isRequired').setValue('true'); if(respTypeId == '000000000001'){ var f = questionTable.formCtrl.form.findField('isFormat'); f.container.up('div.x-form-item').setVisible(true); if(format == "C") questionTable.formCtrl.form.findField('isFormat').setValue('true'); questionTable.gridpanel.setVisible(false); questionTable.detailDialog.setWidth(500); questionTable.detailDialog.setHeight(290); } else if((respTypeId == "000000000007") || (respTypeId== "000000000008")){ questionTable.gridpanel.setVisible(true); questionTable.respTypeDS.reload({ params: {questionId:id} }); var f = questionTable.formCtrl.form.findField('isFormat'); f.container.up('div.x-form-item').setVisible(false); /*var respGrid = []; respGrid[0] = questionTable.formCtrl.form.findField('grid'); respGrid[0].setTitle('$responsetitle');*/ questionTable.detailDialog.setWidth(500); questionTable.detailDialog.setHeight(480); } else{ var f = questionTable.formCtrl.form.findField('isFormat'); f.container.up('div.x-form-item').setVisible(false); questionTable.gridpanel.setVisible(false); questionTable.detailDialog.setWidth(500); questionTable.detailDialog.setHeight(290); } questionTable.formCtrl.form.load({ url:'ajax2/Gemini?action=demand.web.ajax.ShowEditDemandQuestionAction' + "&questionId="+ id, waitMsg:'$loadmsg', success:function(form, action) { } }); } }