PDA

View Full Version : [CLOSED] MVC How to handle GridPanel ItemDblClick DirectEvent



ViDom
May 22, 2013, 8:25 PM
Hi,
next question: How to write redirecting to specific url like for example Contractor/Edit/{0} {0}-index of dbl clicked row(Id value of element):

Here is what I tryed;


@(Html.X().Container()
.ID("containerContractor")
.Layout(LayoutType.Fit)
.Items(
Html.X().GridPanel()
.Title("Contractors")
.Layout(LayoutType.Fit)
.AnchorHorizontal("100%")
.AnchorVertical("100%")
.Store(Html.X().Store()
.RemotePaging(true)
.PageSize(10)
.Model(Html.X().Model()
.Fields(
new ModelField("Akro"),
new ModelField("Name", ModelFieldType.String)
)
)
.DataSource(Model)
)
.ColumnModel(
Html.X().Column().Text("Akro").DataIndex("Akro").Flex(1),
Html.X().Column().Text("Name").DataIndex("Name")
)
.SelectionModel(
Html.X().RowSelectionModel().Mode(SelectionMode.Si ngle)
)
.View(Html.X().GridView().StripeRows(true))
.DirectEvents(de=>de.ItemDblClick.Action="Edit")
.BottomBar(
Html.X().PagingToolbar()
.Items(
Html.X().ToolbarSpacer(10)
)
)
)
)

What am I missing here?

Thanks,
ViDom

geoffrey.mcgill
May 22, 2013, 8:42 PM
Hello,

You can set the .Url property of the DirectEvent.

ViDom
May 22, 2013, 8:50 PM
Hello,

You can set the .Url property of the DirectEvent.

but how to pass a id value there?

Baidaly
May 23, 2013, 1:40 AM
Hello!

Try to pass parameters using ExtraParams:



.DirectEvents(de=> {
de.ItemDblClick.Action="Edit";
de.ItemDblClick.ExtraParams.Add(new Parameter("id", "record.data.id", ParameterMode.Raw));
})


Also, what do mean:


How to write redirecting to specific url

You want to redirect browser or just direct request to the right Action in Controller?

ViDom
May 23, 2013, 6:28 AM
Hello!

Try to pass parameters using ExtraParams:



.DirectEvents(de=> {
de.ItemDblClick.Action="Edit";
de.ItemDblClick.ExtraParams.Add(new Parameter("id", "record.data.id", ParameterMode.Raw));
})


Also, what do mean:



You want to redirect browser or just direct request to the right Action in Controller?

direct request to right action.
passing id by extra parameter doesn't work this is generated url for action :http://localhost:49902/Contractor/Edit?_dc=1369290385391 which is not correct

Daniil
May 23, 2013, 9:14 AM
Hi,

You can modify a DirectEvent's URL within its Before handler.

de.ItemDblClick.Before = "o.url += '/' + record.data.someField;"

ViDom
May 23, 2013, 5:29 PM
Hi,

You can modify a DirectEvent's URL within its Before handler.

de.ItemDblClick.Before = "o.url += '/' + record.data.someField;"

Thanks @Daniil:)
it work exactly how I want.

thread can be closed:)