PDA

View Full Version : [FIXED] SelectionModel Listeners



Timothy
Oct 03, 2008, 5:38 PM
Hello,

The following example has mysteriously stopped working over the past couple SVN check-outs. When you run the example below, and select a row you will notice that the record.data is undefined and record = true.

Example.aspx:


<%@ Page Language="C#" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Permissions.DataSource = new object[] {
new object[] { 1, "Permission", "Permission 1" },
new object[] { 2, "Permission", "Permission 2" },
new object[] { 3, "Permission", "Permission 3" },
new object[] { 4, "Permission", "Permission 4" },
new object[] { 5, "Permission", "Permission 5" },
new object[] { 6, "Permission", "Permission 6" }
};
Permissions.DataBind();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Example</title>
</head>
<body>
<p><a href="Example.aspx">Reload</a></p>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
<ext:ScriptManager ID="ScriptManager2" runat="server" StateProvider="PostBack" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<ext:Store ID="Permissions"
runat="server"
AutoLoad="True"
GroupField="GroupingName">
<Reader>
<ext:ArrayReader ReaderID="PermissionId">
<Fields>
<ext:RecordField Name="PermissionId" />
<ext:RecordField Name="GroupingName" />
<ext:RecordField Name="DisplayName" />
</Fields>
</ext:ArrayReader>
</Reader>
<SortInfo Field="DisplayName" />
</ext:Store>
<ext:GridPanel ID="GridPanel"
runat="server"
StoreID="Permissions"
AutoExpandColumn="DisplayName"
AutoHeight="True"
StripeRows="True"
Width="300">
<ColumnModel>
<Columns>
<ext:Column ColumnID="GroupingName" DataIndex="GroupingName" Header="Group" />
<ext:Column ColumnID="DisplayName" DataIndex="DisplayName" Header="Permission" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel ID="PermissionSelection" runat="server">
<Listeners>
<BeforeRowSelect Handler="alert(record.data); return false;" />
</Listeners>
</ext:CheckboxSelectionModel>
</SelectionModel>
</ext:GridPanel>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>


Beautified


this.PermissionSelection = new Ext.grid.CheckboxSelectionModel({
proxyId: "PermissionSelection",
listeners: {
beforerowselect: {
fn: function(el, rowIndex, record, keepExisting) {
alert(record.data);
return false;
}
}
},
serverID: "PermissionSelection"
});


ExtJS API says:


beforerowselect : ( <code>SelectionModel this</code>, <code>Number rowIndex</code>, <code>Boolean keepExisting</code>, <code>Record record</code> )


Wrong order? ;)

Cheers,
Timothy

Vladimir
Oct 03, 2008, 5:52 PM
Thanks for bug reporting. Fixed (as always the fix in SVN)

Timothy
Oct 03, 2008, 5:58 PM
Confirmed, thanks!

Cheers,
Timothy

Timothy
Oct 04, 2008, 1:07 PM
You can mark this one [fixed] :)

Cheers,
Timothy