在网格中,我在 ext.net 中有以下行,在 V1.X 中工作正常,但在 V2.x 中产生问题
<Listeners>
<HeaderClick Handler="return performSort(this, columnIndex);"
</Listeners>
来自 Ext.NET Breaking_Changes 文档:
http://examples.ext.net/#/Getting_Started/Release_Documents/BREAKING_CHANGES/
154. The GridPanel HeaderMouseDown and HeaderDblClick events have been removed.
Its HeaderClick and HeaderContextMenu have been moved to ColumnModel/GridHeaderContainer.
希望这可以帮助。
编辑:添加代码示例来演示属性配置
例子
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
{
new object[] { "test1", "test2", "test3" },
new object[] { "test4", "test5", "test6" },
new object[] { "test7", "test8", "test9" }
};
}
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" />
<ext:ModelField Name="test3" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test1" DataIndex="test1" />
<ext:Column runat="server" Text="Test2" DataIndex="test2" />
<ext:Column runat="server" Text="Test3" DataIndex="test3" />
</Columns>
<Listeners>
<HeaderClick Handler="alert('Clicked ' + column.dataIndex);" />
</Listeners>
</ColumnModel>
</ext:GridPanel>
</form>
</body>
</html>