[CLOSED] Token is not unique error for nested grid

  1. #1

    [CLOSED] Token is not unique error for nested grid

    Hi,

    I am creating a nested grid and getting following error :

    Token is not unique
    -------------------
    ID = ext.net.global.script.before
    TagName = anchor
    Match = <#:anchor id='ext.net.global.script.before' />

    Following is the code that has StateView as parent grid containing RowExpander. On row expand the Insurer grid needs to be shown as a child. Both StateView and Insurer grids are in different folder.

    It is working fine if StateView and Insurer are in the same folder but giving error for different folder.

    StateView.cshtml :

    @model System.Collections.IEnumerable
    
    @(Html.X().ResourceManager())
    
            @(Html.X().GridPanel()
            .ID("stateGrid")
            .Split(true)
            .Header(false)
            .Height(600)
            .Cls("x-grid-custom")     
            .OverflowY(Overflow.Auto)
            .Store(
                Html.X().Store()
                    .RemotePaging(true)
                    .DataSource(Model)
                    .Model(
                        Html.X().Model()
                        .IDProperty("ID")
                        .Fields(
                            new ModelField("ID"),
                            new ModelField("company"),
                            new ModelField("price"),
                            new ModelField("change"),
                            new ModelField("pctChange"),
                            new ModelField("lastChange")
                        )
                    )
                    .ServerProxy(
                        Html.X().AjaxProxy()
                            .Url(Url.Action("StateView"))
                    )
            )
            .ColumnModel(
                Html.X().Column().Cls("custom-header").Text(StateView.GridHeader_KeyState).DataIndex("company").Flex(2),
                Html.X().Column().Cls("custom-header").Text(StateView.GridHeader_ExEnrollPotential).DataIndex("price").Flex(2),
                Html.X().Column().Cls("custom-header").Text(StateView.GridHeader_BenchmarkPlan).DataIndex("change").Flex(2),
                Html.X().Column().Cls("custom-header").Text(StateView.GridHeader_InsurerMarketShare).DataIndex("pctChange").Flex(2),
                Html.X().Column().Cls("custom-header").Text(StateView.GridHeader_PlansFillingToParticipate).DataIndex("lastChange").Flex(2)
            ).HeaderPosition(Direction.Top)
            .Plugins(Html.X().RowExpander()
                        .Loader(Html.X().ComponentLoader()
                            .Url(Url.Action("GetInsurer", "Insurer"))
                                .Mode(LoadMode.Component)
                        .LoadMask(mask => mask.ShowMask = true)
                        .Params(ps => ps.Add(new Parameter("id", "this.record.getId()", ParameterMode.Raw)))
                       )
                       .Listeners(events =>
                            {
                                events.Expand.Handler = "this.grid.doLayout();";
                                events.Collapse.Handler = "this.grid.doLayout();";
                            })
                    )
            )
    StateViewController.cs :
    public ActionResult StateView()
            {
                
                return View(new object[]
                    {
                        new object[] { "1", "California", "aaa", "aaa", "aaa", "aaa" },
                        new object[] { "2", "New York", "bbb", "bbb", "bbb", "bbb" },
                        new object[] { "3", "Texas", "ccc", "ccc", "ccc", "ccc" },
                        new object[] { "4", "Florida", "ddd", "ddd", "ddd", "ddd" },
                        new object[] { "5", "Illinois", "eee", "eee", "eee", "eee" },
                        new object[] { "6", "Michigan", "fff", "fff", "fff", "fff" },
                        new object[] { "7", "North Carolina", "ggg", "ggg", "ggg", "ggg" },
                        new object[] { "8", "Virginia", "hhh", "hhh", "hhh", "hhh" },
                        new object[] { "9", "New Jersey", "iii", "iii", "iii", "iii" },
                        new object[] { "10", "Georgia", "jjj", "jjj", "jjj", "jjj" },
                        new object[] { "11", "San Diego", "kkk", "kkk", "kkk", "kkk" },
                        new object[] { "12", "Dallas", "lll", "lll", "lll", "lll" },
                        new object[] { "13", "San Jose", "mmm", "mmm", "mmm", "mmm" },
                        new object[] { "14", "Indianapolis", "nnn", "nnn", "nnn", "nnn" },
                        new object[] { "15", "San Francisco", "ooo", "ooo", "ooo", "ooo" },
                        new object[] { "16", "Columbus", "ppp", "ppp", "ppp", "ppp" },
                        new object[] { "17", "Houston", "qqq", "qqq", "qqq", "qqq" },
                        new object[] { "18", "Detroit", "rrr", "rrr", "rrr", "rrr" }
                    });
            }
    Insurer.cshtml :
    @model System.Collections.IEnumerable
    
            @(Html.X().GridPanel()
            .ID("insurerGrid")
            .Split(true)
            .Header(false)
            .Height(400)
            .Cls("x-grid-custom")     
            .OverflowY(Overflow.Auto)
            .Store(
                Html.X().Store()
                    .DataSource(Model)
                    .Model(
                        Html.X().Model()
                        .IDProperty("ID")
                        .Fields(
                            new ModelField("ID"),
                            new ModelField("company")
                        )
                    )
            )
            .ColumnModel(
                Html.X().Column().Cls("custom-header").Text("Company").DataIndex("company").Flex(1)
            ).HeaderPosition(Direction.Top)       
            .View(Html.X().GridView().StripeRows(true))
            )
    InsurerController.cs :
    public ActionResult GetInsurer(string id)
            {
                object[] data = new object[]
                    {
                        new object[] { "1", "Insurer 1", "aaa", "aaa", "aaa", "aaa" },
                        new object[] { "2", "Insurer 2", "bbb", "bbb", "bbb", "bbb" },
                        new object[] { "3", "Insurer 3", "ccc", "ccc", "ccc", "ccc" },
                        new object[] { "4", "Insurer 4", "ddd", "ddd", "ddd", "ddd" },
                        new object[] { "5", "Insurer 5", "eee", "eee", "eee", "eee" },
                        new object[] { "6", "Insurer 6", "fff", "fff", "fff", "fff" },
                        new object[] { "7", "Insurer 7", "ggg", "ggg", "ggg", "ggg" },
                        new object[] { "8", "Insurer 8", "hhh", "hhh", "hhh", "hhh" },
                        new object[] { "9", "Insurer 9", "iii", "iii", "iii", "iii" },
                        new object[] { "10", "Insurer 10", "jjj", "jjj", "jjj", "jjj" },
                        new object[] { "11", "Insurer 11", "kkk", "kkk", "kkk", "kkk" },
                        new object[] { "12", "Insurer 12", "lll", "lll", "lll", "lll" },
                        new object[] { "13", "Insurer 13", "mmm", "mmm", "mmm", "mmm" },
                        new object[] { "14", "Insurer 14", "nnn", "nnn", "nnn", "nnn" },
                        new object[] { "15", "Insurer 15", "ooo", "ooo", "ooo", "ooo" },
                        new object[] { "16", "Insurer 16", "ppp", "ppp", "ppp", "ppp" },
                        new object[] { "17", "Insurer 17", "qqq", "qqq", "qqq", "qqq" },
                        new object[] { "18", "Insurer 18", "rrr", "rrr", "rrr", "rrr" }
                    };
                return this.ComponentConfig("Insurer", new object[] { data });
            }
    Please suggest.
    Last edited by Daniil; Nov 05, 2013 at 8:36 AM. Reason: [CLOSED]
  2. #2
    Hi @alsg,

    I think you should remove this:
    .ID("insurerGrid")
    Probably, the inner grid are rendered with the same ids.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @alsg,

    I think you should remove this:
    .ID("insurerGrid")
    Probably, the inner grid are rendered with the same ids.
    Daniil,

    I tried with above solution but still getting same error.

    Also I don't understand the error message content : ID = ext.net.global.script.before

    In other posts ID is some controls ID which might be included multiple times. But here its something related to scripts.

    Thanks
  4. #4
    You may be right. I will try to reproduce.
  5. #5
    Quote Originally Posted by alscg View Post
    It is working fine if StateView and Insurer are in the same folder but giving error for different folder.
    I cannot reproduce. It works for me in both the cases.

Similar Threads

  1. Replies: 3
    Last Post: Oct 10, 2013, 4:03 PM
  2. [OPEN] [#330] A suggestion to eradicate "Token is not unique" errors
    By michaeld in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 28, 2013, 6:01 AM
  3. [CLOSED] Token is not unique
    By SFritsche in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 04, 2013, 8:08 AM
  4. TokenNotUniqueException: Token is not unique
    By sfvaleriano in forum 2.x Help
    Replies: 8
    Last Post: Dec 28, 2012, 7:51 AM
  5. Replies: 6
    Last Post: Oct 15, 2012, 6:20 AM

Posting Permissions