I want to Submit form panel with treepanel checked nodes Ids, in one call to the controller

  1. #1

    I want to Submit form panel with treepanel checked nodes Ids, in one call to the controller

    @section body
              .FieldDefaults(fd => fd.LabelWidth = 110)
                      .DirectEvents(de =>
                          de.Click.Action = "CreateRole";
                          de.Click.Method = HttpMethod.POST;
                          de.Click.Type = DirectEventType.Submit;
                          de.Click.FormID = "CreateRolePanel";
                          de.Click.Before = "return App.CreateRolePanel.isValid();";
                          de.Click.EventMask.ShowMask = true;
                          de.Click.Success = "showAlert('Operation succeeded', 'Add succeeded');";
                          de.Click.Failure = "showAlert('Operation failed', 'Add failed')";
                                       .ID("Tag").Name("Tag").Value(Model.Tag).Value(Model.Tag).FieldLabel(TxAdminPortal.ResourceFiles.ViewsResources.Tag).PaddingSpec("0 0 5 0"),
                                  X.Container().ID("ViewRolesDetails").Layout("hbox").PaddingSpec("0 0 5 0")
                              X.Container().ID("newLangName").Layout("hbox").PaddingSpec("0 0 5 0")
                               X.Container().ID("Description").Layout("hbox").PaddingSpec("0 0 5 0")
                                            .Listeners(l =>
                                                //l.CheckChange.Handler = "Ext.get(this.getView().getNode(item))[checked ? 'addCls' : 'removeCls']('complete')";
                                                l.CheckChange.Fn = "callCreate";
                                                l.AfterRender.Handler = "this.getRootNode().expand(true);";
                                                l.AfterRender.Delay = 50;
                                                           X.Button().Text("Get Completed Tasks").Handler("callCreate")
                                   // X.Button().Text("Get Completed Tasks").Handler("getTasks")
    Last edited by fabricio.murta; Mar 03, 2016 at 1:27 PM. Reason: Please use [code] or [html] tags on code you paste in posts.
  2. #2
    Hello @Maher! Welcome to Ext.NET forums!

    Here's how you get all checked nodes on a TreePanel: TreePanel with Checkbox Enabled Children. (I believe you based your sample code from this, but just to confirm that as a correct step)

    Now, with the items in hand, you can pass them as parameter using the de.Click.Extraparams property. Something like this:
                    de.Click.ExtraParams.Add(new Parameter()
                        Name = "checkedIds",
                        Value = "getCheckedIds()",
                        Mode = ParameterMode.Raw
    Assuming you have a getCheckedIds() function that will return an array with the checked IDs in the Tree Panel.

    I hope this helps!

    On a side note, please, whenever you paste code in forum threads, wrap it in [ code] tags. That improves readability and makes it easier to read. Also, reviewing the indentation of the pasted code helps considerably and we love to help threads with nicely formatted and written examples! :)
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] Read all checked nodes in treepanel by code_behind
    By ucaneto in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Dec 02, 2014, 8:32 PM
  2. [CLOSED] Get Checked nodes from TreePanel. js
    By Django in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 23, 2013, 5:21 PM
  3. Replies: 18
    Last Post: Jan 23, 2013, 3:20 PM
  4. Replies: 11
    Last Post: Sep 27, 2012, 10:04 PM
  5. TreePanel enumerate through checked nodes
    By PeterSam in forum 1.x Help
    Replies: 1
    Last Post: Feb 02, 2009, 5:25 PM

Tags for this Thread

Posting Permissions