[CLOSED] MVC How to handle GridPanel ItemDblClick DirectEvent

  1. #1

    [CLOSED] MVC How to handle GridPanel ItemDblClick DirectEvent

    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.Single)
            )
            .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
    Last edited by Baidaly; May 23, 2013 at 6:47 PM. Reason: [CLOSED]
  2. #2
    Hello,

    You can set the .Url property of the DirectEvent.
    Geoffrey McGill
    Founder
  3. #3
    Quote Originally Posted by geoffrey.mcgill View Post
    Hello,

    You can set the .Url property of the DirectEvent.
    but how to pass a id value there?
  4. #4
    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?
    Last edited by Baidaly; May 23, 2013 at 1:48 AM.
  5. #5
    Quote Originally Posted by Baidaly View Post
    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/Ed...=1369290385391 which is not correct
  6. #6
    Hi,

    You can modify a DirectEvent's URL within its Before handler.
    de.ItemDblClick.Before = "o.url += '/' + record.data.someField;"
  7. #7
    Quote Originally Posted by Daniil View Post
    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:)

Similar Threads

  1. [CLOSED] Getting a handle on the GridPanel from its Store
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 10, 2013, 4:04 PM
  2. Replies: 4
    Last Post: Apr 09, 2013, 2:10 AM
  3. Replies: 3
    Last Post: Jan 03, 2013, 6:57 PM
  4. Replies: 0
    Last Post: Jul 27, 2012, 7:54 PM
  5. [CLOSED] Handle enter keypress on gridpanel
    By jchau in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 23, 2010, 4:38 PM

Tags for this Thread

Posting Permissions