This is a migrated thread and some comments may be shown as answers.

[Solved] Insert and Cancel buttons missing when grid has no Edit command

1 Answer 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Axel
Top achievements
Rank 1
Axel asked on 29 Nov 2011, 11:12 AM
Hello!

I want a grid where it is possible to insert and delete records, but not to edit them. However, when I make a grid without the Edit button the "Insert" and "Cancel" buttons do not appear in the grid.

Thus I wonder if this is a bug or if grids with inserts, but without edits, are not supported (I have not seen any mention of this in the documentation).

I have attached two images showing the problem, and also a sample project.

Thanks in advance for any answers!

Sincerely,
Axel

1 Answer, 1 is accepted

Sort by
0
Axel
Top achievements
Rank 1
answered on 29 Nov 2011, 04:28 PM
I made an ad hoc workaround, removing the edit button.

In the grid:
.Columns(columns => {
    columns.Bound(avm => avm.Nummer);
    columns.Command(commands => {
        commands.Delete();
        commands.Edit();
    });
})
.ClientEvents(events => events.OnRowDataBound("hideEdit"))

And a JavaScript function
function hideEdit(e) {
    //It should be safe to assume that we will only have one element
    //of class .t-grid-edit per row (and perhaps there should be a
    //check to assure that we have even one)
    $(e.row).find('.t-grid-edit')[0]="";
}
Tags
Grid
Asked by
Axel
Top achievements
Rank 1
Answers by
Axel
Top achievements
Rank 1
Share this question
or