Grid DropDownList and ServerFiltering

1 Answer 98 Views
DropDownList Grid
Edgar81
Top achievements
Rank 1
Edgar81 asked on 02 Aug 2021, 07:38 AM

Scenario - I'm Yasen Petrov and I have to create groups of Bulgarian football players (with a variable number of players). The number of players is huge, so I have to use server filtering. I already have the name of the groups, but no player has been assigned to them. I have to be able to add the players, move them up or down in the list, remove them if needed.

Each player has a Guid and a Name. Some examples:

{d912f311-5c6a-450b-886e-8b4effbd6828, Dimitar Berbatov}
{ec621b1e-3a13-4a8c-bcad-78eddae91752, Borislav Mihaylov}
{440eefce-c4c3-44d5-9320-f07fa84d5997, Krasimir Balakov}

When pressing Save, the list of Guids must be sent to the server.

I think a batch editing grid with a GridEditMode.PopUp mode should do the trick. It will have a single column (Name).

I use this DropDownList in another view:

@(Html.Kendo().DropDownListFor( m => m.PlayerId ).MinLength( 3).EnforceMinLength(true).Delay(500).OptionLabel( "Search by player name" )
                                   .DataTextField( "Name").DataValueField( "Id" ).Filter( FilterType.Contains).AutoBind(false)
                                   .DataSource(source => {
                                      source.Read(read =>
                                      {
                                         read.Action( "SearchPlayer", "PlayerGroups" ).Data( "additionalData" ).Type( HttpVerbs.Post);
                                      }).ServerFiltering(true);
                                   }))


How would I go about doing this? I looked for examples of EditorTemplateName, but I haven't been able to find something useful for my case.

Could anyone provide some guidance? Thank you!

   

1 Answer, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 04 Aug 2021, 02:32 PM

Hello Edgar81,

Thank you for the details provided.

In order to achieve the desired behavior, I would recommend using the Editing functionality of a Custom Editor.

The following demo is representing the implementation and behavior of "DropDownListFor" Editor and ClientTemplate for the "Category" field. The Category field is a Model with properties "CategoryID" and "CategoryName" (similar to your scenario). Do not forget to use the UIHint annotation in your ViewModel:

Give a try to the approach above and let me know if further assistance is needed.

Kind Regards,
Anton Mironov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
DropDownList Grid
Asked by
Edgar81
Top achievements
Rank 1
Answers by
Anton Mironov
Telerik team
Share this question
or