Nov 20, 2013, 2:25 PM
[CLOSED] Checkbox Selection Model - loses its checked state on calling direct method
Hi!
I have used checkbox selection model in the grid panel and it is important for me to call direct method on cellediting - edit listener to check some validation.
The problem is when I select the record and perform any edition, direct method works perfectly but selection of the record does not remain in its checked state.
Request you to please look into the below code and suggest the appropriate solution.
I have used checkbox selection model in the grid panel and it is important for me to call direct method on cellediting - edit listener to check some validation.
The problem is when I select the record and perform any edition, direct method works perfectly but selection of the record does not remain in its checked state.
Request you to please look into the below code and suggest the appropriate solution.
<script runat="server">
public class testClass
{
public string TextString1 { get; set; }
public string TextString2 { get; set; }
}
protected void Page_Load(object sender, EventArgs e)
{
List<testClass> lstTest = new List<testClass>();
for (int i = 1; i < 3; i++)
{
testClass tst = new testClass();
tst.TextString1 = "String" + i;
tst.TextString2 = "";
lstTest.Add(tst);
}
StoreTest.DataSource = lstTest.ToList();
StoreTest.DataBind();
}
[DirectMethod]
public string TestMethod()
{
try
{
return "Direct Method Return";
}
catch (Exception ex)
{
return "NotOk";
}
}
</script>
<script>
var gridEdit = function (editor, e) {
App.StoreTest.getAt(e.rowIdx).data.Text2 = App.StoreTest.data.items[e.rowIdx].data.Text1;
if (App.StoreTest.data.items[e.rowIdx].data.Text1 == "String1") {
App.direct.TestMethod({
success: function (result) {
alert(result);
}
});
}
e.grid.view.refreshNode(e.rowIdx);
}
</script>
<ext:ResourceManager ID="ResourceManager1" runat="server"></ext:ResourceManager>
<ext:GridPanel ID="Test" runat="server" IDMode="Static" RowLines="true" ColumnLines="true" Height="500" BodyBorder="1" AutoScroll="true">
<Store>
<ext:Store ID="StoreTest" runat="server" IDMode="Static">
<Model>
<ext:Model ID="TestModel" runat="server" IDMode="Static" IDProperty="Num1" ClientIdProperty="DoNotUse">
<Fields>
<ext:ModelField Name="Text1" Mapping="TextString1"/>
<ext:ModelField Name="Text2" Mapping="TextString2"/>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column ID="colText1" runat="server" DataIndex="Text1" Text="Text1" Sortable="true" Hideable="true">
<Editor>
<ext:TextField ID="txtText1" runat="server" />
</Editor>
</ext:Column>
<ext:Column ID="colText2" runat="server" DataIndex="Text2" Text="Text2" Sortable="true" Hideable="true">
<Editor>
<ext:TextField ID="txtText2" runat="server" />
</Editor>
</ext:Column>
</Columns>
</ColumnModel>
<Plugins>
<ext:CellEditing ID="CellEditing2" runat="server">
<Listeners>
<Edit Fn="gridEdit" />
</Listeners>
</ext:CellEditing>
</Plugins>
<SelectionModel>
<ext:CheckboxSelectionModel ID="SampleSelectionModel" runat="server" Mode="Multi" />
</SelectionModel>
</ext:GridPanel>
Last edited by Daniil; Nov 26, 2013 at 6:35 AM.
Reason: [CLOSED]