PDA

View Full Version : [CLOSED] Token is not unique error for nested grid



alscg
Oct 31, 2013, 7:02 AM
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).Dat aIndex("price").Flex(2),
Html.X().Column().Cls("custom-header").Text(StateView.GridHeader_BenchmarkPlan).DataInd ex("change").Flex(2),
Html.X().Column().Cls("custom-header").Text(StateView.GridHeader_InsurerMarketShare).Da taIndex("pctChange").Flex(2),
Html.X().Column().Cls("custom-header").Text(StateView.GridHeader_PlansFillingToParticip ate).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.

Daniil
Oct 31, 2013, 7:22 AM
Hi @alsg,

I think you should remove this:

.ID("insurerGrid")

Probably, the inner grid are rendered with the same ids.

alscg
Oct 31, 2013, 7:51 AM
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

Daniil
Oct 31, 2013, 8:14 AM
You may be right. I will try to reproduce.

Daniil
Nov 01, 2013, 5:53 AM
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.