PDA

View Full Version : [CLOSED] FireEvent('selectionchange')



cwolcott
Jan 09, 2013, 8:09 PM
I figured I could try to get a simple answer without a sample while driving home on my 2 hour commute. If need be I can work up an example tonight.

I have the following:


...
<script type="text/javascript" >
function selectRequestRow(selectionModel, records) {
...
}
</script>
...
<ext:GridPanel ID="RequestGridPanel" runat="server" >
...
<SelectionModel>
<ext:RowSelectionModel runat="server" Mode="Single" AllowDeselect="true" />
</SelectionModel>
<Listeners>
<SelectionChange Fn="selectRequestRow" />
</Listeners>
</ext:GridPanel>


I would like to fire the SelectionChange event in a certain situation on the clientside. I thought all I had to do was:



#{RequestGridPanel}.fireEvent('selectionchange');


and the default parameters would automatically be passed.

Second question:

What is the difference between adding a listener for the SelectionChange event to a RowSelectionModel vs a GridPanel?

Vladimir
Jan 09, 2013, 8:54 PM
Try this


var grid = #{RequestGridPanel}.getSelectionModel();

sm.fireEvent('selectionchange', sm, sm.getSelection());




What is the difference between adding a listener for the SelectionChange event to a RowSelectionModel vs a GridPanel?

SelectionChange event is fired by selection model only, grid just relies on this event from selection model (that event is refired by grid when selection model fires it)