PDA

View Full Version : [CLOSED] The ItemSelector can not be empty



CarWise
Nov 27, 2015, 9:10 AM
Hi Guys,

Wondering why I receive above error when using a simple dataview.



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="KlantInfo.aspx.cs" Inherits="Support.Customer.KlantInfo" %>


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" />
<ext:Store ID="strKlantInfo" runat="server">
<Model>
<ext:Model runat="server" IDProperty="ID">
<Fields>
<ext:ModelField Name="cAandachtsPunt" />
<ext:ModelField Name="cBeschrijving" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
<ext:Viewport ID="vpKlantInfo" runat="server" Layout="Fit">
<Items>
<ext:Panel
ID="pnlKlantInfo"
runat="server"
Frame="true"
Layout="FitLayout">
<Items>
<ext:DataView
ID="dvKlantInformatie"
runat="server"
StoreID="strKlantInfo"
DisableSelection="true">
<Tpl runat="server">
<Html>
<tpl for=".">
<div>
<div style="font-weight: bold;background-color:lightgrey">{cAandachtsPunt}></div>
<span>{cBeschrijving}</span>
</div>
</tpl>
</Html>
</Tpl>
</ext:DataView>
</Items>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
</html>

Daniil
Nov 27, 2015, 9:48 AM
Hi Martin,

ItemSelector is a required setting and must be set even in a simple DataView.
http://docs.sencha.com/extjs/5.1/5.1.1-apidocs/#!/api/Ext.view.AbstractView-cfg-itemSelector

I would recommend to change the outer
<div>
to
<div class="my-item">
and set ItemSelector="div.my-item" for the DataView.

You don't really need to set any CSS rules for the "my-item" class. In this case it is just a marker to distinguish the outer div from others.

CarWise
Nov 27, 2015, 10:01 AM
Thanks Daniil,

Expected that ''DisableSelection" would do the trick :)

Martin

Daniil
Dec 01, 2015, 4:48 PM
Agree, it could potentially do that job, but yes, it doesn't it:)