Add parametrs to directEvents

  1. #1

    Add parametrs to directEvents

    I need pass parametr "id" in Action.

           .Width(70)
                        .Commands(
                                 Html.X().GridCommand()
                                    .CommandName("Edit")
                                    .Icon(Icon.NoteEdit)
                                        .ToolTip(t =>
                                        {
                                            t.Text = "Modifica della ripartizione ferie per giorno";
                                        })
                                    )
                                    .ID("ID")
                                .DirectEvents(
                                        directEvents =>
                                        {
                                                 directEvents.Command.Action = "Details";                            
                                        })
                        )
    Action controller:

       // GET: Bob/Details/5
                public ActionResult Details(int id)
                {
                    if (id == null)
                    {
                        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                    }
                    BobRepository bobRepository = new BobRepository();
                    Bob bob = bobRepository.GetBob(id);
                    return View(bob);
                }
    How i can pass .ID("ID") in Action?
  2. #2
    I dont really use razor but this is is the old way of doing it. Note the ExtraParams on the click event. i am sure you easily translate to Razor like DirectEvent.Click.ExtraParams or something like that.
    Note the Mode variable. it is Raw or Value.
    Raw means it will execute the JS and find a value (very helpful)
    Value means just passes it as is
    Good Luck!
    /Z

                                            <DirectEvents>
                                                <Click 
                                                    Url="/Controller/Method" 
                                                    Timeout="60000"
                                                    CleanRequest="true" 
                                                    Method="POST"
                                                    Success="alert('success');"
                                                    Failure="Ext.Msg.show({
                                                        title:   'Error',
                                                        msg:     result.message || result.errorMessage,
                                                        buttons: Ext.Msg.OK,
                                                        icon:    Ext.MessageBox.ERROR
                                                    });">
                                                    <EventMask MinDelay="250" />
                                                    <ExtraParams> 
                                                        <ext:Parameter Name="test" Value="App.someComponent.getValue()" Mode="Raw" />                                                    
                                                    </ExtraParams> 
                                                </Click>
                                            </DirectEvents>
  3. #3
    read this post from matrixwebtech
    /Z

    https://forums.ext.net/showthread.ph...ge-always-show

Similar Threads

  1. Replies: 1
    Last Post: Apr 27, 2015, 6:08 PM
  2. Replies: 1
    Last Post: Apr 04, 2014, 12:30 AM
  3. Replies: 10
    Last Post: Jan 31, 2014, 12:42 AM
  4. TreePanel Directevents
    By obiwan74 in forum 2.x Help
    Replies: 1
    Last Post: Jan 02, 2013, 6:00 AM
  5. Dynamic DirectEvents
    By Dominik in forum 1.x Help
    Replies: 3
    Last Post: Jul 30, 2010, 1:58 PM

Posting Permissions