0
votes

I have a situation here: I have a form field with trigger xtype, what I want to happen on my trigger function is to open a window with a list or grid of data in it. I want to get the value of those data and assign it as the value of my form field with trigger. Can anyone help me solve this problem. Thank you very much.

1

1 Answers

1
votes

You have multiple solutions for this.

  1. You can make use Saki's simple message bus to do the communication between extjs components.

  2. You can create an custom event for your trigger field. When user selects a record in your window, fire the event with the selected record.

Inside your onTriggerClick :

  1. Display your window with grid / view for user selection

Inside your Window (on some submit button):

 onSubmitClick: function(){
    // Get the selected record & fire event
    var selected = grid.getSelectionModel().getSelected();
    triggerFieldObject.fireEvent('recordSelect',selected);
}

Inside your event processing (Will be on TriggerField):

onRecordSelect: function(record) {

    // Now you have access to the selected record.. process it,
    // Set the trigger field value etc
    this.setValue('Your Value for Trigger Field');
}

Note: This is a skeleton code and not a complete solution. You will need to add your code according to your requirements.