PDA

View Full Version : [CLOSED] TreeView ItemMove DirectEvent not triggering when ExtraParams are defined.



CarlosG
Jan 16, 2014, 1:10 AM
Problem Description:

I'm trying to code Drag&Drop functionality on a TreePanel. As expected, I'm trying to trigger a controller method to handle the change in the database.

When ExtraParams are defined for the DirectEvent, the controller method is not called. I've checked the traffic and it doesn't send any request to the server. I haven't had time to inspect the sequence of events client-side.

How to reproduce the issue:

1) Define any TreePanel (like the ones in the examples). In my case, I'm defining the view in C# code.

2) Add the TreeViewDragDrop plugin:


this.View.Add(new TreeView()
{
Plugins =
{
new TreeViewDragDrop()
{
ContainerScroll = true,
AllowLeafDrop = true,
}
}
});


3) Setup the DirectEvent


this.DirectEvents.ItemMove.Action = "MoveNode";
this.DirectEvents.ItemMove.ExtraParams.Add(ViewMod elHelpers.CreateParameter("item", "item", ParameterMode.Raw));
this.DirectEvents.ItemMove.ExtraParams.Add(ViewMod elHelpers.CreateParameter("oldParent", "oldParent", ParameterMode.Raw));
this.DirectEvents.ItemMove.ExtraParams.Add(ViewMod elHelpers.CreateParameter("newParent", "newParent", ParameterMode.Raw));

4) Setup the controller method


public ActionResult MoveNode(string item, string oldParent, string newParent)
{

//Do something here ...

return this.Direct();
}

If I set a breakpoint on this controller, it's never reached and as I said before, no request is being sent from the browser.

Any idea of what might be happening is appreciated.

Cheers,

Carlos

Daniil
Jan 16, 2014, 5:25 AM
Hi Carlos,

"item", "oldParent" and "newParent" are a Node instances.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.NodeInterface

All of them are too complex objects with cross-references


. Then you cannot be serialized to strings and be sent to a server.

You should retrieve and pass simple things. For example, an id of moved node.

item.getId()

CarlosG
Jan 16, 2014, 6:06 AM
Hi Daniil,

Thank you for your prompt response. As usual, it's all sorted. I should pay more attention when reading the documentation.

Cheers,

Carlos