1
votes

I have a form which has a Search button and a textbox which is displayed a s none.Onclick of this button, it opens an extjs window which has a grid. After selecting the grid column, on clicking OK button of the window, the selected value needs to be populated into the text box in the previous form. I am able to alert the selected value but not able to set it to the textbox. Below is the code which I am using. This is the javascript function called when I click the Ok button in the window.

function replaceButton(){
  document.getElementById('pidVal').style.display="block";
  document.getElementById('search').style.display="none";
  var selectedRecord =   Ext.getCmp('pidList').getSelectionModel().getSelected().get('pid');
  alert(selectedRecord);    // The selected val is alerted correctly here
  pidVal.setValue(selectedRecord);
  Ext.getCmp('searchWin').close();  
}

Could somebody help me in this?

Thanks is advance...

2

2 Answers

0
votes

Where do you set pidVal variable? Is it undefined?

Maybe document.getElementById('pidVal').getCmp().setValue(...); or something...

0
votes

try with

Ext.getCmp('pidVal').setValue(selectedRecord);//solution using "id"

or goes like this, consider,

fieldName = Ext.create('Ext......., {
                fieldLabel: 'Name',
                labelSeparator: "",
                name: 'pidname',//for example
                id:'piVal',....});

fieldName.setValue(selectedRecord);//solution using "name" of the field