Jul 04, 2012, 1:03 PM
[CLOSED] [RAZOR] MessageBus not triggering on duplicate message
I have an application which consists of 2 panels. I'm using the messagebus to notify the 2nd panel of actions (button presses, etc) selected on the 1st panel
My controller method is called the first time a new value is selected, but subsequent selection of the same option doesn't trigger the controller method
Code in 1st panel
My controller method is called the first time a new value is selected, but subsequent selection of the same option doesn't trigger the controller method
Code in 1st panel
items.Add(Html.X().Button()
.ID("searchButton")
.Text("Search")
.DirectEvents(directEvents =>
{
directEvents.Click.Url = "/Shared/OnSearchButtonDirectClick";
})
.Listeners(listeners =>
{
listeners.Click.Handler = "Ext.net.Bus.publish('Search.SearchButton', 'Search');";
}));
Code in 2nd Panel Html.X().Panel()
.ID("Panel2")
.Title("Messages")
.Width(300)
.Height(300)
.MessageBusListeners(messageBus =>
{
messageBus.Add(new MessageBusListener()
{
Name = "Search.*",
Handler = "this.body.createChild({html: name + ' from ' + data, tag:'p'});" +
"$.ajax({ " +
"url: \"/Control2/MessageBusEvent\" + \"?data=\" + data," +
"success: function(data) { window.alert(data); }," +
"error: function(x, t, e) { window.alert(e); }," +
" });"
});
})
Controller Code public JsonResult MessageBusEvent(string data)
{
string msg = X.Msg.Alert("DirectEvent", "MessageBusEvent " + data).ToScript();
// Do Stuff
return new JsonResult() { Data = msg, JsonRequestBehavior = JsonRequestBehavior.AllowGet};
}
Last edited by Daniil; Jul 04, 2012 at 10:03 PM.
Reason: [CLOSED]