This question is locked. New answers and comments are not allowed.
I have the following grid
The problem is that for the custom command "closeTrade", all html is rendered but the javascript is not executed, therefore no ajax call is made to the server.
What am I doing wrong?
I'm using the latest version, Q1 2012, released 02/14/2012
.DetailView(strikePriceDetails => { strikePriceDetails.ClientTemplate( Html.Telerik().Grid<OcViewModel>() .Name("OC_") .ToolBar(toolbar => toolbar.Insert().ButtonType(GridButtonType.Image). ImageHtmlAttributes(new { style = "margin-left:0", title = "Add trade" })) .DataKeys(keys => keys.Add(x => x.Id)) .DataBinding(binding => { binding.Ajax().Select("Select", "Contracts", new { .. } ); binding.Ajax().Insert("Save", "Contracts"); binding.Ajax().Update("Save", "Contracts"); binding.Ajax().Delete("Delete", "Contracts", new { .. } ); }) .Columns(columns => { columns.Command(commands => commands.Edit()) .HtmlAttributes(new { @class = "grid-header", @title = "Edit" }); columns.Command( commands => commands.Delete()) .HtmlAttributes(new { @class = "grid-header col-delete", @title = "Delete" }); columns.Command( commands => commands.Custom( "closeTrade" ) .DataRouteValues( route => route.Add( oc => oc.Id ).RouteKey( "TradeId" ) ) .Ajax( true ) .Action( "CloseTrade", "Contracts" ) ) .HtmlAttributes( new { @class = "grid-header col-close", @title = "Close trade" } ) .HeaderHtmlAttributes( new { @class = "grid-header" } ); columns.Bound( od => od.TradeDate ).HtmlAttributes( new { @class = "col-tradingdate" } ); // other columns }) .Editable(editing => editing.Mode(GridEditMode.PopUp)) .ClientEvents(events => events. OnComplete( "onTradesComplete" ). OnDataBinding("..."). OnDataBound("..."). OnEdit("..."). OnSave("..."). OnRowDataBound("..."). OnError("...")) .Sortable() .Footer(false) .ToHtmlString() );)
<script type="text/javascript">
function onTradesComplete(e)
{
alert("Trades_onComplete");
log( "e", e );
if ( e.name == "closeTrade" )
{
var trade = e.response.trade;
log("trade", trade.TradeDate);
}
}
What am I doing wrong?
I'm using the latest version, Q1 2012, released 02/14/2012