[CLOSED] Saving state of application elements

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] Saving state of application elements

    Hello
    In following sample when you select one of the tree nodes, grid is shown in central panel. When you resize columns, change their position, or visibility, close application and then open it again, changes will be saved and columns will be displayed as user arranged them. So far so good. Problem is when you click between nodes. Nothing is remembered then and grid is shown with no regard to user changes.
    I tried similar technique for remembering last selected accordion panel and last selected node but it does not work at all :(
    How that would be possible?

    index.cshtml
        Html.X().Panel().Layout(LayoutType.Border).Border(false).Height(600)
        .Items
        (
            Html.X().Panel().Title("Components").Region(Region.West).Layout(LayoutType.Accordion).Width(200)
            .Items
            (
                Html.X().TreePanel().Title("Codebooks")
                .Root
                (
                    Html.X().Node().Text("Codebooks").Expanded(true)
                    .Children
                    (
                        Html.X().Node().Text("Countries").Leaf(true),
                        Html.X().Node().Text("Cities").Leaf(true)
                    )
                )
                .DirectEvents(de =>
                {
                    de.SelectionChange.Url = "ShowCodebook";
                    de.SelectionChange.ExtraParams.Add(new Parameter("codebook", "selected.length>0 ? selected[0].data.text: ''", ParameterMode.Raw));
                }),
                Html.X().TreePanel().Title("Astrology")
                .Root
                (
                    Html.X().Node().Text("Signs").Expanded(true)
                    .Children
                    (
                        Html.X().Node().Text("Aries").Leaf(true),
                        Html.X().Node().Text("Taurus").Leaf(true),
                        Html.X().Node().Text("Gemini").Leaf(true),
                        Html.X().Node().Text("Cancer").Leaf(true),
                        Html.X().Node().Text("Leo").Leaf(true),
                        Html.X().Node().Text("Virgo").Leaf(true),
                        Html.X().Node().Text("Libra").Leaf(true),
                        Html.X().Node().Text("Scorpio").Leaf(true),
                        Html.X().Node().Text("Sagittarius").Leaf(true),
                        Html.X().Node().Text("Capricorn").Leaf(true),
                        Html.X().Node().Text("Aquarius").Leaf(true),
                        Html.X().Node().Text("Pisces").Leaf(true)
                    )
                )
            )
            ,
            Html.X().Panel().ID("Center1").Region(Region.Center).Title("Main").Layout(LayoutType.Fit)
        )
    Codebook.cshtml
    @model string
    
    @(
        Html.X().GridPanel().Title(Model).Stateful(true).StateID("grid_" + Model).StateEvents(new string[] { "columnresize", "columnmove", "columnvisible", "columnsort" })
        .ColumnModel
        (
            c =>
            {
                if (Model == "Countries")
                {
                    c.Columns.Add(Html.X().Column().Text("Country name"));
                    c.Columns.Add(Html.X().Column().Text("Area"));
                    c.Columns.Add(Html.X().Column().Text("Inhabitans"));
                    c.Columns.Add(Html.X().Column().Text("BDP"));
                    c.Columns.Add(Html.X().DateColumn().Text("President"));
                }
                else
                {
                    c.Columns.Add(Html.X().Column().Text("City name"));
                    c.Columns.Add(Html.X().Column().Text("Area"));
                    c.Columns.Add(Html.X().Column().Text("Inhabitans"));
                    c.Columns.Add(Html.X().Column().Text("Country"));
                    c.Columns.Add(Html.X().DateColumn().Text("Major"));
                }
            }
        )
    )
    Controller
            public ActionResult Index()
            {
                return View();
            }
    
            public ActionResult ShowCodebook(string codebook)
            {
                return new Ext.Net.MVC.PartialViewResult
                {
                    ViewName = "Codebook",
                    Model = codebook,
                    ContainerId = "Center1",
                    ClearContainer = true,
                    RenderMode = RenderMode.AddTo
                };
    Last edited by Daniil; Nov 07, 2015 at 8:13 AM. Reason: [CLOSED]

Similar Threads

  1. [CLOSED] Saving grid state to database
    By pj_martins in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 13, 2012, 3:07 PM
  2. Replies: 2
    Last Post: Dec 07, 2011, 4:37 AM
  3. [CLOSED] Saving grid state using CookieProvider - problem
    By voipswitch in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Aug 11, 2011, 12:44 PM
  4. Replies: 2
    Last Post: Apr 14, 2011, 9:03 AM
  5. Viewport and inner elements
    By unaltro2 in forum 1.x Help
    Replies: 0
    Last Post: Feb 01, 2011, 8:11 AM

Tags for this Thread

Posting Permissions