Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top