Jul 18, 2011, 2:42 PM
'insertAdjacentHTML is null or not defined' error when trying to tie a Listview on a grid
Hi,
I was following this sample to make a custom gridview with a listview inside (pretty much like the link) when I got this error. I barely customized the Grid (added a PagingToolbar and added more columns) and I dont know where I may be wrong. Help plz?
Grid and Store
André Custódio
I was following this sample to make a custom gridview with a listview inside (pretty much like the link) when I got this error. I barely customized the Grid (added a PagingToolbar and added more columns) and I dont know where I may be wrong. Help plz?
Grid and Store
<!-- Store para a GridView -->
<ext:Store ID="Store1" runat="server">
<Reader>
<ext:JsonReader IDProperty="iPedido">
<Fields>
<ext:RecordField Name="iPedido" />
<ext:RecordField Name="dtEmissao" />
<ext:RecordField Name="vlLiquido" />
<ext:RecordField Name="strNome" />
<ext:RecordField Name="strApelido" />
<ext:RecordField Name="strApelidoRep" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<!-- Aqui termina o Store -->
<!-- Aqui vem a Grid -->
<ext:GridPanel ID="gdpPedidos" runat="server" TrackMouseOver="true" Collapsible="true"
StoreID="Store1" AnimCollapse="true" Height="500px">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:RowNumbererColumn Header="Seq" />
<ext:Column Header="Pedido" DataIndex="iPedido" />
<ext:Column Header="Emissão" DataIndex="dtEmissao" />
<ext:Column Header="Situação" DataIndex="indiSituacao" />
<ext:Column Header="Valor Líquido" DataIndex="vlLiquido" />
<ext:Column Header="Nome Fantasia Cliente" DataIndex="strNome" />
<ext:Column Header="Apelido Representante" DataIndex="strApelidoRep" />
<ext:Column Header="Apelido Vendedor" DataIndex="strApelido" />
</Columns>
</ColumnModel>
<View>
<ext:GridView ID="GridView1" runat="server" ForceFit="true">
<Listeners>
<BeforeRefresh Fn="clean" />
</Listeners>
</ext:GridView>
</View>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>
<BottomBar>
<ext:PagingToolbar runat="server" ID="pgnToolbar" PageSize="20">
</ext:PagingToolbar>
</BottomBar>
<Plugins>
<ext:RowExpander ID="RowExpander1" runat="server">
<Template ID="Template1" runat="server">
<Html>
<div id="row-{ID}" style="background-color: White;"></div>
</Html>
</Template>
<DirectEvents>
<BeforeExpand OnEvent="BeforeExpand">
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={gdpPedidos.body}" />
<ExtraParams>
<ext:Parameter Name="id" Value="record.id" Mode="Raw" />
</ExtraParams>
</BeforeExpand>
</DirectEvents>
</ext:RowExpander>
</Plugins>
</ext:GridPanel>
<!-- Aqui termina a Grid -->
My Code-behindprivate void RemoveFromCache(string id)
{
ResourceManager1.AddScript("removeFromCache({0});", JSON.Serialize(id));
}
private void AddToCache(string id)
{
ResourceManager1.AddScript("addToCache({0});", JSON.Serialize(id));
}
protected void BeforeExpand(object sender, DirectEventArgs e)
{
string id = e.ExtraParams["id"];
Store store = new Store { ID = "StoreRow_" + id };
JsonReader reader = new JsonReader();
reader.IDProperty = "ID";
reader.Fields.Add("ID", "Name");
store.Reader.Add(reader);
List<object> data = new List<object>();
for (int i = 1; i <= 10; i++)
{
data.Add(new { ID = "P" + i, Name = "Product " + i });
}
store.DataSource = data;
this.RemoveFromCache(store.ID);
store.Render();
this.AddToCache(store.ID);
Ext.Net.ListView list = new Ext.Net.ListView
{
ID = "ListViewRow_" + id,
MultiSelect = true,
StoreID = "{raw}StoreRow_" + id,
Height = 200
};
list.Columns.AddRange(new ListViewColumn[] {
new ListViewColumn {
Header = "Products's Name",
DataIndex = "Name"
}
});
this.RemoveFromCache(list.ID);
list.Render("row-" + id, RenderMode.RenderTo);
this.AddToCache(list.ID);
}
Thanks for your Attention,André Custódio