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

[Solved] Commands.Delete() Only?

12 Answers 281 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.
TonyRasa
Top achievements
Rank 1
TonyRasa asked on 18 Mar 2010, 07:37 PM
Hi,

I have a Grid using Ajax data binding, and I want to have a Delete Command button (and ONLY a delete command).  But, if I don't add in an Edit command and fully implement the required bindings, then none of the command buttons render (I just get an empty td where the buttons should be).

Is there some trick I'm missing to have a Delete button without also enabling edit functionality?

Thanks
Tony

12 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 19 Mar 2010, 09:05 AM
Hello TonyRasa,

This is a known issue and I am glad to inform you that it is already fixed. The fix will be included in our next release.

Currently the workaround to use only Delete command is to set Editable(settings => settings.Enabled(true).
Here is a code snippet showing what I mean:
...
.Columns(columns =>
{
   ...
   columns.Command(commands => commands.Delete())
})
.Editable(settings => settings.Enabled(true)
...

Regards,
Georgi Krustev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Temesgen Meheret
Top achievements
Rank 1
answered on 18 Apr 2010, 08:54 PM
I had the similar issue and setting the editable settings fixed it. Thanks.


0
Colin
Top achievements
Rank 1
answered on 02 Jul 2010, 06:23 AM
Hi,

I tried this and it worked fine for display mode, but when I tried to insert a record there were no command buttons rendered, and so I could not insert the record.

My grid definition is:

<%= Html.Telerik().Grid(Model)
        .Name("TestGrid")
        .ToolBar(commands => commands.Insert())
        .DataKeys(keys => keys.Add(c => c.TimeLogged).RouteKey("time"))
        .DataBinding(dataBinding => dataBinding
            .Server()
            .Insert("Insert", "TestEntry")
            .Update("Update", "TestEntry")
            .Delete("Delete", "TestEntry"))
        .Columns(columns =>
        {
            columns.Bound(c => c.TimeLogged).Width(200).Visible(false);
            columns.Bound(c => c.Weight).Width(200).Format("{0:N3}");
            columns.Bound(c => c.Location).Width(250);
            columns.Bound(c => c.Reason).Width(200);
            columns.Bound(c => c.Description).Width(200);
            columns.Command(commands =>
            {
                commands.Delete();
            }).Width(200);
        })
        .Editable(settings => settings.Enabled(true))
        .Pageable()
        .Sortable()
        
%>

Actually I'd like to achieve being able to insert a record without any other command button in display mode. Is there any way to do this?

Thanks,
Col.
0
Erik
Top achievements
Rank 1
answered on 02 Sep 2010, 12:30 PM
I'd like to second Colin's question. I am trying to get Insert functionality to work in my grid but there are no command buttons rendered (the input fields are rendered just fine). I have tried using Inline as well as PopUp, to no avail.

What could cause this? My code is as follows (using version 2010.2.825):

<%: Html.Telerik().Grid(Model.Accounts)
          .Name("Acccounts")
          .ToolBar(commands => commands.Insert())
          .DataKeys( keys => keys.Add( a => a.Email))
          .DataBinding(binding =>
            binding.Ajax()
                    .Insert( "AddAccount", "Company" ))
          .Columns(columns =>
            {
              columns.Bound(a => a.ContactName);
              columns.Bound(a => a.MobileNumber);
              columns.Bound(a => a.Email);
              columns.Bound(a => a.IMEI);
              columns.Bound(a => a.SipAccount.Username);
            })
          .Editable(editing => editing.Enabled(true).Mode( GridEditMode.PopUp ))
          .Footer(false)
%>

0
Atanas Korchev
Telerik team
answered on 02 Sep 2010, 12:34 PM
Hi Erik,

There is a known issue with insert only grids. We have fixed it so it works as expected in InForms and PopUp editing mode. We have still not enabled it for inline mode as we are not sure where the render the "insert" and "cancel" buttons if there is no command column in the grid.

If you are interested you can open a support ticket and I will send you the updated build which enables "insert-only" popup or informs editing.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Erik
Top achievements
Rank 1
answered on 02 Sep 2010, 12:37 PM
Hi Atanas,

Thanks for you lightning-quick response. I will create a support ticket for this as you suggest.

Best Regards,

Erik
0
Erik
Top achievements
Rank 1
answered on 02 Sep 2010, 12:43 PM
Ah, I seem to have hit Reply too soon.

Hi Anatas,

I am not allowed to create support tickets as I am using the open source edition of the MVC Extensions. Is there any other way I can get the build you mentioned?

Regards,

Erik
0
Atanas Korchev
Telerik team
answered on 02 Sep 2010, 02:17 PM
Hello Erik,

I am sending you the internal build so you can try it.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Erik
Top achievements
Rank 1
answered on 02 Sep 2010, 03:28 PM
Hi Atanas,

Perfect! The buttons show up just fine in both PopUp and InForm mode. Thanks!

As a mini feature-request, could I suggest wrapping said buttons in a DIV element with a class (e.g. t-edit-form-buttons)? This would allow us to assign styles to it more easily than going through the t-edit-form-container t-grid-action t-button hierarchy.

Thanks very much for you help, also on behalf of my customer :)

Erik
0
Erik
Top achievements
Rank 1
answered on 03 Sep 2010, 11:37 AM
Hi Atanas,

Once again thanks for your help, everything now works like a dream!

In one of your replies you said:

"We have still not enabled it for inline mode as we are not sure where the render the "insert" and "cancel" buttons if there is no command column in the grid."

Would it be a good suggestion to replace the "Add new record" button in the Toolbar with those two ("Insert" and "Delete") buttons? The "Add new record" button has no functionality when you are inserting a new record (clicking it does nothing and you hsouldn't want to insert another record while not finished inserting the first) so replacing this would make the intent perfectly clear from a user's perspective.

Just my 2c :)

Erik
0
H
Top achievements
Rank 1
answered on 09 Sep 2010, 03:58 PM
We're also trying to have an Insert-only grid. 

We are on the current release, 2010.2.825, but the PopUp & InForms mode do not include the Insert/Cancel buttons unless I add an Edit command column.  We are currently working around this by setting that column to Hidden, but is there a better fix for this?

We are using server binding, does that make a difference?
0
Erik
Top achievements
Rank 1
answered on 09 Sep 2010, 07:43 PM
Hi H,

I don't think using server binding makes a difference. I'd suggest downloading the hotfix out of the previous post and trying that, it solved the problem for me (and without breaking anything, which is a nice bonus ;)

Erik
Tags
Grid
Asked by
TonyRasa
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Temesgen Meheret
Top achievements
Rank 1
Colin
Top achievements
Rank 1
Erik
Top achievements
Rank 1
Atanas Korchev
Telerik team
H
Top achievements
Rank 1
Share this question
or