2014-10-17 83 views
0

我創建一個Kendo網格,我想要一個自定義命令,可以將兩個參數傳遞給我的mvc控制器方法。現在,這裏是我的網格代碼:劍道網格自定義命令不顯示

@(Html.Kendo().Grid<iPlan.Syspro.Beekman.Portal.Agents.Models.SalesOrderDetailViewModel>() 
.Name("Details") 
.HtmlAttributes(new {@style = "width:80vw"}) 
.Columns(columns => 
{ 

    columns.Bound(c => c.Agent).Width(100); 
    columns.Bound(c => c.SalesOrder).Width(150); 
    columns.Bound(c => c.Line).Width(60); 
    columns.Bound(c => c.StockCode).Width(150); 
    columns.Bound(c => c.SerialNumber).Width(150); 
    columns.Bound(c => c.DerivativeDescription).Width(150); 
    columns.Bound(c => c.StockCodeDescription).Width(150); 
    columns.Bound(c => c.OrderQty).Width(150); 
    columns.Bound(c => c.OnBackorder).Width(150); 
    columns.Bound(c => c.QtyAvailable).Width(150); 
    columns.Bound(c => c.ShippedQuantity).Width(150); 
    columns.Bound(c => c.SalesPrice).Width(150); 
    columns.Bound(c => c.AlternativeSerial).Width(150); 
    columns.Bound(c => c.AlternativeSerialReason).Width(150); 
    columns.Bound(c => c.VinNr).Width(150); 
    columns.Bound(c => c.DealerOrderNr).Width(150); 
    columns.Bound(c => c.WipNr).Width(150); 
    columns.Bound(c => c.GrnNr).Width(150); 
    columns.Bound(c => c.AsnNr).Width(150); 
    columns.Bound(c => c.DeliveryNoteNr).Width(150); 
    columns.Command(command => {command.Edit(); command.Destroy();}).Width(172);   
    columns.Command(command => command.Custom("BlaBla").Click("approve").Text("Approve"));  
})  

.Editable(editable => editable.Mode(GridEditMode.InLine)) 
.Sortable() 
.Scrollable() 
.Groupable() 
.Pageable(pageable => pageable 
    .Refresh(true) 
    .PageSizes(true) 
    .ButtonCount(5))  
.DataSource(dataSource => dataSource 
    .Ajax() 
    .Events(events => events.Error("error_handler")) 
    .Read(read => read.Action("SalesOrdersDetail_Read", "Inbox").Data("getSalesOrder")) 
    .Update(update => update.Action("SalesOrdersDetail_Update","InboxAgent")) 
    .Destroy(destroy => destroy.Action("SalesOrdersDetail_Destroy","InboxAgent")) 
    .Create(create => create.Action("SalesOrdersDetail_Create","InboxAgent")) 
    .Model(model => 
    { 
     model.Id(p => p.SalesOrder); 
     model.Field(p => p.StockCode).Editable(false); 
     model.Field(p => p.SerialNumber).Editable(false); 
     model.Field(p => p.DerivativeDescription).Editable(false); 
     model.Field(p => p.StockCodeDescription).Editable(false); 
     model.Field(p => p.SalesOrder).Editable(false);    
     model.Field(p => p.Agent).Editable(false); 
     model.Field(p => p.Line).Editable(false); 
     model.Field(p => p.OrderQty).Editable(false); 
     model.Field(p => p.OnBackorder).Editable(false); 
     model.Field(p => p.QtyAvailable).Editable(false); 
     model.Field(p => p.ShippedQuantity).Editable(false); 

    })   

)) 

現在的問題是,有甚至不顯示自定義命令我試圖創建一個列。我讀過一個視圖網站,其中很少有人提到Kendo網格自定義命令可能包含一個錯誤。如果是這樣,有人可以告訴我如何解決這個問題嗎?

回答

1

試試這個

command.Custom("Delete").SendDataKeys(true).Click("PropertyPage.DeleteProperty"); 

或經過this link