Jan 05, 2015, 11:14 PM
[CLOSED] Publish via Bus through DirectEvent
I have passed simple variables (String, Integer) through the MessageBus and ExtraParameters, but never an Array within the data structure.
On the client side I gather several data items, one of which is a list of selected Ids from a combobox, and publish them via the MessageBus.
Building the list of product ids from the ComboBox that is multiSelect works, but is there a better way? Produces [31, 64].
Am I passing the Array correctly or does it need to be encoded?
When I grab the extraParameter what else do I need to do to get it back into an Array?
On the client side I gather several data items, one of which is a list of selected Ids from a combobox, and publish them via the MessageBus.
Building the list of product ids from the ComboBox that is multiSelect works, but is there a better way? Produces [31, 64].
...
var products = new Array();
for (var I = 0; I < App.comboBoxProducts.getSubmitArray().length; i++)
products.push(App.comboBoxProducts.getSubmitArray()[i].value);
var data = new Array();
data[0] = Ext.String.trim(App.comments.getValue());
data[1] = products;
Ext.net.Bus.publish('RequestDialog.Finalize', data);
...
I have a MessageBusDirectEvent that will catch the message and call the direct event passing the data.Am I passing the Array correctly or does it need to be encoded?
...
<ext:MessageBusDirectEvent Name="" onEvent="Finalize">
<ExtraParams>
<ext:Parameter Name="Comments" Value="data[0]" Mode="Raw" />
<ext:Parameter Name="Products" Value="data[1]" Mode="Raw" />
</ExtraParams>
</ext:MessageBusDirectEvent>
...
Finally in the direct event I need to iterate of the list of product Ids that were selected.When I grab the extraParameter what else do I need to do to get it back into an Array?
var products = e.ExtraParameters["Products"];
I will try to put together a simple example if it will help.
Last edited by Daniil; Jan 06, 2015 at 12:10 PM.
Reason: [CLOSED]