PDA

View Full Version : [CLOSED] Use RowEditing and CheckboxSelectionModel



UnifyEducation
Jul 29, 2013, 5:31 PM
Hi,

I'm using RowEditing and CheckboxSelectionModel in the same GridPanel. But it does not work in expect: when I click the checkbox, it active the editor too.
Can you tell me how to work around with this problem?
Thank you


@model dynamic

@{
Layout = null;
}

@(Html.X().ResourceManager())

@(Html.X().GridPanel().Title("Test GridPanel").ForceFit(true).Height(200)
.Store(Html.X().Store().Model(Html.X().Model().Fie lds(Html.X().ModelField().Name("sample_field")))
.DataSource(new List<object> {new{sample_field="Test Sample Field"}, new{sample_field="Test Sample Field 2"}}))
.ColumnModel(Html.X().Column().DataIndex("sample_field").Text("Sample Field Header")
.Editor(Html.X().TextField()))
.SelectionModel(Html.X().CheckboxSelectionModel(). Mode(SelectionMode.Multi).CheckOnly(true))
.Plugins(Html.X().RowEditing().ClicksToEdit(1)))

Baidaly
Jul 30, 2013, 1:37 AM
Hello!

Try to add the following CellClick handler:



@(Html.X().GridPanel()
.Listeners(l => l.CellClick.Handler = "if (cellIndex == 0) { return false; }")
...
)

Daniil
Jul 30, 2013, 5:37 AM
Here is another possible solution.

<ext:RowEditing runat="server" ClicksToEdit="1">
<Listeners>
<BeforeEdit Handler="return !e.column.isCheckerHd;" />
</Listeners>
</ext:RowEditing>

It might be a bit better, because it doesn't depend on the "cellIndex == 0" condition. In a common case, a CheckboxSelectionModel can inject its column anywhere.

UnifyEducation
Jul 30, 2013, 8:30 AM
Thank you. You can close this thread.