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

[Solved] No Insert button if no Edit Command?

3 Answers 165 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.
Robert
Top achievements
Rank 1
Robert asked on 21 Feb 2012, 04:40 PM
I have a grid that allows the insertion and removal of records - the existing records should not be edited.
I have added the Delete command, the Insert toolbar, and the Insert and Delete databindings.

When I click "Add new record", I am able to enter data, but the Insert button is missing. Only when I add the Edit command and Edit databinding does the Insert button appear.

Is this by design or am I missing a nuance here?
@(Html.Telerik().Grid(Model)
.Name("Grid")
.DataKeys(keys => keys.Add(o => o.DiscountId))
.DataBinding(binding => binding.Ajax()
    .Select("_BindDiscounts", "Part", new { id = Model.CategoryId })
    .Insert("_DiscountAdd", "Part", new { id = Model.CategoryId })
    .Delete("_DiscountDelete", "Part"))
.Columns(columns =>
{
    columns.Bound(o => o.EffectiveDate).Title("Effective Date").Format("{0:d}").EditorTemplateName("EffectiveDate");
    columns.Bound(o => o.DiscountPercent).Title("Discount %");
    columns.Command(commands =>
        {
                commands.Delete();
        });
})
.ToolBar(toolbar =>
    {
            toolbar.Insert();
    })
.Sortable(sorting => sorting
    .SortMode(GridSortMode.MultipleColumn)
    .OrderBy(sortOrder => sortOrder.Add(o => o.EffectiveDate).Descending())
    )
.Groupable(grouping => grouping
    .Enabled(true)
    )
.Scrollable(scrolling => scrolling.Enabled(true))
.Pageable(paging => paging.PageSize(30)
    .Style(GridPagerStyles.NextPreviousAndNumeric)
    .Position(GridPagerPosition.Bottom)
    )
)

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 22 Feb 2012, 12:05 PM
Hello Robert,

This behavior is by design and this is not supported only in the InLine edit mode. You should either use a different editing mode or an edit column should be added.

All the best,

Petur Subev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
dstj
Top achievements
Rank 1
answered on 16 Mar 2012, 06:10 PM
Hi,

I have to side with Robert here. This design decision is a inconvenience. I too have a situation where I only want to Insert or Delete. It's a simple 3-column grid + 1 hidden ID column, a popup insert dialog is overkill and breaks the "fluidity" of the UX... Using a InLine edit would make sense for me.

Thanks for considering it a enhancement suggestion,

Dominic.

0
Sreeram
Top achievements
Rank 1
answered on 03 Apr 2012, 09:54 PM

put this in your script tag in the view.

 

$(document).ready(function () {
        $('.t-grid-edit').hide();
    });


Also, keep a dummy edit functionality so that the buttons show up.

Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
dstj
Top achievements
Rank 1
Sreeram
Top achievements
Rank 1
Share this question
or