PDA

View Full Version : [CLOSED] Direct Method - App.direct undefined



registrator
Jul 23, 2014, 6:46 AM
Hi all

I thought that defining a Direct method would be as easy as: decorate a controller with [DirectController], decorate an action with [DirectMethod], define a handler as "App.direct.MyMethodname()"

Every time I do this I get the error in the browser saying that the App.direct is undefined. What am I missing here please?

Defining a double click for a GridPanel row (I am not sure if this is the right way to do this!)


[DirectController]
public class Checkbox_SelectionController : Controller
{
public ActionResult Index()
{
return View(new Checkbox_SelectionModel());
}

[DirectMethod]
public ActionResult DblClick()
{
return this.Direct();
}
}


.Listeners(l =>
{
l.ItemDblClick.Handler = "App.direct.DblClick();";
})

Thank you

Daniil
Jul 23, 2014, 12:45 PM
Hi @registrator,

Do you use Areas? If yes, please read this thread.
http://forums.ext.net/showthread.php?36771

registrator
Jul 23, 2014, 1:14 PM
I do, yes. Actually, I am doing this on your MVC examples.
I have added

[DirectController(AreaName = "GridPanel_Selection_Models")]

And now the error is different:


Uncaught TypeError: undefined is not a function

This is very easy to replicate on your MVC examples. Area GridPanel_Selection_Models, add to the GridPanel in the Checkbox_Selection folder


.Listeners(l =>
{
l.ItemDblClick.Handler = "App.direct.DblClick();";
})

Add this to the controller:


[DirectMethod]
public ActionResult DblClick()
{
return this.Direct();
}

Should be very simple.

Thank you

Daniil
Jul 23, 2014, 1:28 PM
I think you should use:

App.direct.GridPanel_Selection_Models.DblClick();

registrator
Jul 23, 2014, 1:47 PM
That's it. Thank you.