简体   繁体   English

如何在剑道网格下拉菜单中使用级联?

[英]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.实际上,我的要求是在 WorkcenterName 发生更改时获取活动名称,我需要在下拉列表中显示相应的活动。 Activity i will get from gridData(this is variable in my example).我将从 gridData 获得的活动(在我的示例中这是变量)。

I tried using cascadeFrom , I am not able to get the value.我尝试使用 cascadeFrom ,但无法获得该值。 I hope i explained my requirement clearly.我希望我清楚地解释了我的要求。

Here with attached Dojo link.此处附有 Dojo 链接。 Please have a look my code and give the solutions for this.请查看我的代码并为此提供解决方案。 http://dojo.telerik.com/APeVA 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.我能够发现您的 dojo 代码有一些问题,并在此处使用工作示例更新了您的 dojo。 Here is a list of some of the problems I found, the solution was probably a combination more than 1 of these.这是我发现的一些问题的列表,解决方案可能是其中 1 个以上的组合。

  1. There was no cascadeFrom or cascadeFromField defined in your activity drop down.您的活动下拉列表中没有定义cascadeFromcascadeFromField
  2. I normalized your gridData data set, separating the activities into a separate list that I used to fill the activities drop down.我标准化了您的gridData数据集,将活动分成一个单独的列表,我用来填充活动下拉列表。 I replaced it with an ActivityId in the gridData .我用gridDataActivityId替换了它。 Kendo data sources do not support a object or array field types. Kendo 数据源不支持对象或数组字段类型。
  3. Added a name attribute to the workCenterName drop down so it could be found by cascade setting.在 workCenterName 下拉列表中添加了一个name属性,以便可以通过级联设置找到它。
  4. Added an id to the gridData, this helped the edit/cancel/delete work properly.向 gridData 添加了一个 id,这有助于编辑/取消/删除正常工作。

I have done that in a .cshtml.我已经在 .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() .这里的秘密是.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.不确定您是否可以更改它,但我认为它必须在 Views/Shared/EditorTemplates 中,并且我已经定义了两个下拉列表,第二个带有.CascadeFrom()属性,就像您在网格外使用它一样。 Hope this can help you, feel free to ask anything you need!希望可以帮到你,有什么需要可以随时咨询!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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