Ruvo
Ruvo

Reputation: 727

kendo grid custom command not displaying

I'm creating a Kendo Grid and I want a custom command that can pass two parameters to my mvc controller method. Now here is the code for my grid:

  @(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);

    })        

))

Now the problem is that there does not even display a column for the custom command I'm trying to create. I've read on a view sites and few of them mentions that Kendo Grid custom commands could contain a bug. If so, can someone please tell me how to workaround this?

Upvotes: 0

Views: 1404

Answers (1)

Mhadonis
Mhadonis

Reputation: 340

try this

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

or go through this link

Upvotes: 1

Related Questions