Get Values from Current Selected Row in Ext.Net RowSelectionModel?

c# entity-framework ext.net

Question

I am aware that this question has already been addressed in relation to ASP.Net in instances like this. I must rephrase my question since I did not understand the circumstances and the responses did not apply to my Ext.Net component.

In my scenario, I have a LinqDataSource connection to an entity framework. In addition, the GridPanel contains a Selection model with the following code. I have a GridPanel with a Store and a JsonReader.

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

The first thing I need to know is what the RowSelect Handler performs, or maybe I should ask if someone could help clarify that line. I really don't understand how that works, but when I copied that line from the ext.net page's example, it gave me all the data from the chosen row in my EditPanel.

My second query relates to the fact that my GridPanel has 9 columns that correspond to the data from my Entity Framework. How do I get the information from the first column of the chosen row?

I appreciate it.

1
0
10/20/2011 7:45:58 AM

Accepted Answer

This key:

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

initializes your FormPanel's fields with values from the record.

You may look at some information here: http://docs.sencha.com/ext-js/3-4/#!/api/Ext.form.BasicForm-method-loadRecord

If you want to set form values automatically using values from a store, this is quite helpful. For example, you have a store with loaded values and you want to display detail information about records.

This key:

#{UserForm}.record = record;

sets the chosen record in the UserForm's "record" field. I don't believe this serves any function in Ext.NET, although it could be beneficial in application logic.


And here's the response to the second query:

{GridID}.selModel.getSelected().data. Id / You may substitute any record field name for "Id" as the function #GridID.selModel.getSelected() returns the chosen record.

1
10/20/2011 8:10:02 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow