Jun 30, 2015, 1:01 PM
Selection Model Not working properly in GridPanel
Hi
Here, i've problem with rowselectionmodel,i.e,Initially i bind data to grid ,then I select one record,and when i click GetData button,again I bind data(may contain old records) to store.Here My problem is when i click a record(which is already selected by user),that row not able to selected.how can i resolve this problem.
Mohan
Here, i've problem with rowselectionmodel,i.e,Initially i bind data to grid ,then I select one record,and when i click GetData button,again I bind data(may contain old records) to store.Here My problem is when i click a record(which is already selected by user),that row not able to selected.how can i resolve this problem.
<ext:ResourceManager ID="rsmngr" runat="server" Theme="Neptune" />
<ext:Viewport ID="vwprtMyworks" runat="server" Layout="BorderLayout">
<Items>
<ext:Panel ID="pnlMyWorks" runat="server" Region="Center" Layout="FormLayout" AutoScroll="true">
<Items>
<ext:Button ID="btnGetData" runat="server" Text="GetData">
<DirectEvents>
<Click OnEvent="btnGetData_Click">
<EventMask ShowMask="true" />
</Click>
</DirectEvents>
</ext:Button>
<ext:GridPanel ID="grdpnlMyWorks" runat="server" Layout="FormLayout" Width="500">
<Store>
<ext:Store ID="strMyWorks" runat="server" PageSize="10" AutoDataBind="true">
<Model>
<ext:Model ID="mdlMyWorks" runat="server" IDProperty="TestOrderId">
<Fields>
<ext:ModelField Name="TestOrderId" />
<ext:ModelField Name="JobPackCode" />
<ext:ModelField Name="TestName" />
<ext:ModelField Name="TestOrderDescription" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column ID="colJobPackCode" runat="server" Text="Code" DataIndex="JobPackCode" Width="100" />
<ext:Column ID="colTestName" runat="server" Text="Test Name" DataIndex="TestName" Width="150" />
<ext:Column ID="colTestNameOrderDescription" runat="server" DataIndex="TestOrderDescription" Text="Description" Flex="1" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="rwselmdlMyWorks" Mode="Multi" runat="server">
</ext:RowSelectionModel>
</SelectionModel>
</ext:GridPanel>
</Items>
</ext:Panel>
</Items>
</ext:Viewport>
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
public class TestOrder
{
public Guid TestOrderId { get; set; }
public string TestName { get; set; }
public string TestOrderDescription { get; set; }
public string JobPackCode { get; set; }
}
protected void btnGetData_Click(object sender, DirectEventArgs e)
{
rwselmdlMyWorks.ClearSelection();
BindData();
}
private void BindData()
{
TestOrder to1 = new TestOrder();
to1.TestOrderId = new Guid("276C19AA-41A4-4535-9447-00E7A0B6D5B9");
to1.TestName = "Alkalinity Analysis";
to1.JobPackCode = "00015/ML/15";
to1.TestOrderDescription = "00015/ML/15 Alkalinity Analysis";
TestOrder to2 = new TestOrder();
to2.TestOrderId = new Guid("3FDC67DB-9E87-4D22-A0B2-077850669A42");
to2.TestName = "PH";
to2.JobPackCode = "00016/ML/15";
to2.TestOrderDescription = "00016/ML/15 PH";
List<TestOrder> lstTestOrder = new List<TestOrder>();
lstTestOrder.Add(to1);
lstTestOrder.Add(to2);
strMyWorks.DataSource = lstTestOrder;
strMyWorks.DataBind();
}
}
RegardsMohan