Ext.Net RowSelectionModel,从当前选定的行获取值?
我知道这个问题之前已经在类似的情况下处理过,关于 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此代码:
通过记录中的值初始化 FormPanel 的字段。
您可以在此处查看一些详细信息: http://docs.sencha.com/ext-js/3-4/#!/api/Ext.form.BasicForm-method-loadRecord
如果您想自动设置表单值,这非常有用通过一些商店的值。例如,您有一个已加载值的商店,并且您想要显示有关记录的详细信息。
此代码:
通过选定的记录设置“UserForm”的“record”字段。在 Ext.NET 中,我认为这没有什么目的,但在应用程序逻辑中可能有用。
第二个问题的答案:
{GridID}.selModel.getSelected().data.Id // 您可以放置记录的任何字段名称,而不是“Id”,因为 #{GridID}.selModel.getSelected() 返回选定的记录。
This code:
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:
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.