PDA

View Full Version : [CLOSED] App.direct is not a function ?



dareal
May 02, 2014, 5:20 AM
Hi, need some help..
I'm using MVC Ext.Net latest version

So i did this on my controller



[DirectMethod]
public void DeleteSelectedCampaignBaseBatch(string campaignbasebatch)
{
X.Msg.Alert("", campaignbasebatch).Show();

}


and created JavaScript function on my view as following



<script>
function onDeleteButtonClick() {

var CampaignBaseBatch = App.CustomerApprovalGridPanel.getSelectionModel(). getSelection()[0].get('CampaignBaseBatch');

App.direct.DeleteSelectedCampaignBaseBatch(Campaig nBaseBatch, {
success: function (result) {
alert("Success");

},
failure: function (result) {
alert("Failure");
}

});

}
</script>




and put the function as my handler on a button at GridPanel like this..



Html.X().Button()
.Text("Delete")
.Icon(Icon.Exclamation)
.Handler("onDeleteButtonClick()")


but i keep getting error.. App.direct.DeleteSelectedCampaignBaseBatch is not a function..

What am i missing ?

Thanks before

Vladimir
May 02, 2014, 10:46 AM
Hi

Did you mark controller by DirectController attribute?
See controller code in online sample
http://mvc.ext.net/#/Events/DirectMethod/

dareal
May 02, 2014, 11:49 AM
Ah.. that must be it..

Thank you very much

Please mark this thread as closed