Ext.Net RowSelectionModel,从当前选定的行获取值?

发布于 2024-12-11 03:02:43 字数 838 浏览 0 评论 0原文

我知道这个问题之前已经在类似的情况下处理过,关于 ASP.Net。 但由于我不理解上下文,并且这些答案与我的 Ext.Net 组件不匹配,所以我需要再次询问。

就我而言,我有一个通过 LinqDataSource 连接的实体框架。 我有一个 GridPanel,它有一个包含 JsonReader 的 Store,此外 GridPanel 有一个带有以下代码的选择模型:

            <SelectionModel>
            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
                 <Listeners>
                    <RowSelect Handler="#{EditPanel}.getForm().loadRecord(record);#{UserForm}.record = record;" />
                </Listeners>
            </ext:RowSelectionModel> 
        </SelectionModel>   

第一个问题是,RowSelect 处理程序是做什么的,或者更好地说有人可以向我解释一下该行吗? 我从 ext.net 页面上的示例中复制了该行,它为我提供了所选行中的所有值到我的 EditPanel,但我真的不确定它是如何工作的。

我的第二个问题是,我的 GridPanel 中有 9 列,它们代表来自实体框架的数据。如何获取所选行第一列的数据?

提前致谢!

I know this question has been handeled in similar situations, regarding ASP.Net, before.
But as I did not understand the contexts and as those answers did not match to my Ext.Net component, I need to ask again.

In my case, I have an entity framework connect through my LinqDataSource.
I have a GridPanel which has a Store including a JsonReader, in addition to that the GridPanel has a Selection model with the following code:

            <SelectionModel>
            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
                 <Listeners>
                    <RowSelect Handler="#{EditPanel}.getForm().loadRecord(record);#{UserForm}.record = record;" />
                </Listeners>
            </ext:RowSelectionModel> 
        </SelectionModel>   

First question is, what does the RowSelect Handler do, or let's better say can someone please explain me that line?
I copied that line from the example on the ext.net page and it gives me all the values from the selected row to my EditPanel, but I'm really not sure how that works.

My Second question is, I have 9 columns in my GridPanel which represent the Data from my Entity Framework. How can I get the data from the first column on the selected row?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

栖竹 2024-12-18 03:02:44

此代码:

#{EditPanel}.getForm().loadRecord(record);

通过记录中的值初始化 FormPanel 的字段。

您可以在此处查看一些详细信息: http://docs.sencha.com/ext-js/3-4/#!/api/Ext.form.BasicForm-method-loadRecord

如果您想自动设置表单值,这非常有用通过一些商店的值。例如,您有一个已加载值的商店,并且您想要显示有关记录的详细信息。

此代码:

#{UserForm}.record = record;

通过选定的记录设置“UserForm”的“record”字段。在 Ext.NET 中,我认为这没有什么目的,但在应用程序逻辑中可能有用。


第二个问题的答案:

{GridID}.selModel.getSelected().data.Id // 您可以放置​​记录的任何字段名称,而不是“Id”,因为 #{GridID}.selModel.getSelected() 返回选定的记录。

This code:

#{EditPanel}.getForm().loadRecord(record);

initializes fields of your FormPanel by values in record.

Some details you can look here: http://docs.sencha.com/ext-js/3-4/#!/api/Ext.form.BasicForm-method-loadRecord

This is very useful if you want to set form values automaticaly by values from some store. For example, you have a store with loaded values and you want to display detail information about records.

This code:

#{UserForm}.record = record;

sets 'record' field of 'UserForm' by selected record. In Ext.NET I don't think this have some purpose, but in application logic maybe useful.


And a answer to the second question:

{GridID}.selModel.getSelected().data.Id // Instead of 'Id' you can place any field name of record, because #{GridID}.selModel.getSelected() returns selected record.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文