Dec 05, 2013, 10:00 AM
[CLOSED] Suspend events when selecting gridpanel items using checkboxselectionmodel
Hi all,
We have selection change event in checkboxselectionmodel, In another button event we are selecting gridpanel items using checkboxselectionmodel, At this time selection change event is fired. We used suspendEvents and ResumeEvents but they are not worked.
My question is, how to suspend the events of checkboxselectionmodel while selected items ?
Here is a sample to reproduce the issue
We have selection change event in checkboxselectionmodel, In another button event we are selecting gridpanel items using checkboxselectionmodel, At this time selection change event is fired. We used suspendEvents and ResumeEvents but they are not worked.
My question is, how to suspend the events of checkboxselectionmodel while selected items ?
Here is a sample to reproduce the issue
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SelectionModel.aspx.cs" Inherits="EXT2._2.SelectionModel" %>
<%@ Register Namespace="Ext.Net" Assembly="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>SelectionModel</title>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.GridPanel1.Store.Primary.DataSource = new object[]
{
new object[] { 11, "test_11"},
new object[] { 12,"test_12"},
new object[] { 13,"test_13"},
new object[] { 14,"test_14"},
new object[] { 15,"test_15"},
new object[] { 16,"test_16"},
new object[] { 17,"test_17"},
new object[] { 18,"test_18"},
new object[] { 19,"test_19"},
new object[] { 20,"test_20"}
};
this.GridPanel1.Store.Primary.DataBind();
}
}
protected void chkModelTest_SelectionChangeEvent(object sender, DirectEventArgs e)
{
//do
}
protected void btnSelct_OnEvent(object sender, DirectEventArgs e)
{
object[] ids = new object[2];
ids[0] = 11;
ids[1] = 15;
CheckboxSelectionModel chkSelModle = this.GridPanel1.GetSelectionModel() as CheckboxSelectionModel;
//ToDo:: suspend events
chkSelModle.Select(ids);
// Resume events
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:GridPanel
ID="GridPanel1"
runat="server"
Title="Column Variations"
Width="600"
Height="350">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="Id">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="Name" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ID="clId" DataIndex="Id" runat="server" Text="Id" Flex="1"></ext:Column>
<ext:Column ID="clName" DataIndex="Name" runat="server" Text="Name" Flex="1"></ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel ID="chkModelTest" runat="server" CheckOnly="true" ShowHeaderCheckbox="false">
<DirectEvents>
<SelectionChange OnEvent="chkModelTest_SelectionChangeEvent"></SelectionChange>
</DirectEvents>
</ext:CheckboxSelectionModel>
</SelectionModel>
</ext:GridPanel>
<ext:Button ID="btnSelct" runat="server" Text="Select 11 & 15">
<DirectEvents>
<Click OnEvent="btnSelct_OnEvent"></Click>
</DirectEvents>
</ext:Button>
</form>
</body>
</html>
Last edited by Daniil; Dec 13, 2013 at 5:56 AM.
Reason: [CLOSED]