简体   繁体   中英

How to use Cascade inside kendo grid dropdown?

Actually my requirement is to get the Activity Name when ever the WorkcenterName getting change i need to display corresponding activity in dropdown. Activity i will get from gridData(this is variable in my example).

I tried using cascadeFrom , I am not able to get the value. I hope i explained my requirement clearly.

Here with attached Dojo link. Please have a look my code and give the solutions for this. http://dojo.telerik.com/APeVA

Thanks in advance..

I was able to find a couple of thing wrong with your dojo code and update your dojo here with a working sample. Here is a list of some of the problems I found, the solution was probably a combination more than 1 of these.

  1. There was no cascadeFrom or cascadeFromField defined in your activity drop down.
  2. I normalized your gridData data set, separating the activities into a separate list that I used to fill the activities drop down. I replaced it with an ActivityId in the gridData . Kendo data sources do not support a object or array field types.
  3. Added a name attribute to the workCenterName drop down so it could be found by cascade setting.
  4. Added an id to the gridData, this helped the edit/cancel/delete work properly.

I have done that in a .cshtml. Hope this can help you.

I have defined the columns as follows:

columns.ForeignKey(p => p.Servicio, (System.Collections.IEnumerable)ViewData["SER"], "CodServicio", "DesCorta").Width(75).EditorTemplateName("ServicioTemplate").Title(Recursos.Resource.SERVICIO);
columns.ForeignKey(p => p.Seccion, (System.Collections.IEnumerable)ViewData["SEC"], "CodSeccion", "DesCorta").Width(75).EditorTemplateName("SeccionTemplate").Title(Recursos.Resource.SECCION);

The secret here is .EditorTemplateName() . I have a folder, in a specific location. Not sure if you can change that, but I think it must be in Views/Shared/EditorTemplates and there I have defined both dropdowns, the second one with .CascadeFrom() property just as you would use it outside of a grid. Hope this can help you, feel free to ask anything you need!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM