将parametr传递给directEvents

时间:2018-04-27 21:17:37

标签: asp.net-mvc ext.net

如何将值colum ID (.DataIndex("ID"))传递给Controller中的Action?

  @(Html.X().GridPanel()
                                            .Title("ComponentColumn Pin Editor")
                                            .Width(700)
                                            .Height(300)
                                            .Store(Html.X().Store()
                                                .Model(Html.X().Model()
                                                    .Fields(
                                                        new ModelField("ID", ModelFieldType.Int),

                                                    )
                                                )
                                                .DataSource(Model)
                                            )   
      .ColumnModel(
                                        Html.X().ComponentColumn()
                                            .Editor(true)
                                            .OverOnly(true)
                                            .Pin(true)
                                            .DataIndex("ID")
                                            .Flex(1)
                                            .Text("ID")
                                            .Component(Html.X().NumberField())
      Html.X().GridCommand()
                                .CommandName("Edit")
                                .Icon(Icon.NoteEdit)
                                    .ToolTip(t =>
                                    {
                                        t.Text = "Modifica della ripartizione ferie per giorno";
                                    })
                                )
                                .ID("ID")
                            .DirectEvents(

                                    directEvents =>
                                    {
                                        //  directEvents.Command.Url = "/Details/ID";
                                        directEvents.Command.Action = "Details";
                                        directEvents.Command.ExtraParams.Add(new Parameter()
                                        {
                                            Name = "ID",
                                            Value="ID",
                                        //    Value = "App.GridPanelDistributionReports.getSelectionSubmit().getSelectionModelField().getValue()",
                                            Mode = ParameterMode.Raw
                                        });
                                    })

                    )

我需要从gridTable向Action函数发送值。

在示例中,我看到了:

  Value = "App.GeneratedDistributionId.getValue()",

但我没有理解,如何使用它。 什么是“GeneratedDistributionId”?

1 个答案:

答案 0 :(得分:1)

您需要为对象(网格面板,商店等)提供ID以便在客户端(js)进行访问。我认为ext.net为您的应用自动生成了 GeneratedDistributionId 值。您需要将网格面板ID设置为 GridPanelDistributionReports 。然后你可以访问它。

调试器; 命令添加到您的js,如下所示,以便在启用开发人员工具时等待您的代码:

Value = "debugger;App.GridPanelD..."

然后在调试模式下检查js代码是否正确。