Aug 23, 2012, 7:32 PM
[CLOSED] How to display an Asterisk(*) next to Tpl column
Hi,
Can you please show me how to add an asterisk next to the template field if certain conditions are met. For example, in my code below, I would like to display an asterisk next to the {Description} column if ModelField "MASTEnabled" is "true".
Can you please show me how to add an asterisk next to the template field if certain conditions are met. For example, in my code below, I would like to display an asterisk next to the {Description} column if ModelField "MASTEnabled" is "true".
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="Web.test" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.PlantsStore.DataSource = this.Data;
this.PlantsStore.DataBind();
}
}
private object[] Data
{
get
{
return new object[]
{
new object[] { "3m Co", true },
new object[] { "Alcoa Inc", false },
new object[] { "Wal-Mart Stores, Inc.", true }
};
}
}
</script>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<form id="form1" runat="server">
<div>
<ext:Container ID="Container1" runat="server">
<Items>
<ext:Panel ID="Panel1" runat="server" MarginSpec="14 0 0 650" Border="false">
<Items>
<ext:ComboBox ID="txtPlants" runat="server" EmptyText="Select Plant" ForceSelection="true"
Icon="Building" FieldLabel="Plant" DisplayField="Description" Mode="Remote" ValueField="PlantId"
Editable="false">
<Store>
<ext:Store ID="PlantsStore" runat="server" AutoLoad="true" AutoDataBind="true">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="Description" Type="String" />
<ext:ModelField Name="MASTEnabled" Type="Boolean" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ListConfig Width="520" Height="300" ItemSelector=".x-boundlist-item">
<Tpl ID="Tpl1" runat="server">
<Html>
<tpl for=".">
<tpl if="[xindex] == 1">
<table class="cbDoughName-list">
<tr>
<th>Plant Name :</th>
<th>Enabled :</th>
</tr>
</tpl>
<tr class="x-boundlist-item">
<td style="Padding:3px 0px;">{Description}</td>
<td>{MASTEnabled}</td>
</tr>
<tpl if="[xcount-xindex]==0">
</table>
</tpl>
</tpl>
</Html>
</Tpl>
</ListConfig>
<Triggers>
<ext:FieldTrigger Icon="Clear" HideTrigger="true" />
</Triggers>
<Listeners>
<BeforeQuery Handler="this.getTrigger(0)[this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
<TriggerClick Handler="if(index == 0) { el.focus().clearValue(); trigger.hide(); }" />
<Select Handler="this.getTrigger(0).show();" />
</Listeners>
</ext:ComboBox>
</Items>
</ext:Panel>
</Items>
</ext:Container>
</div>
</form>
</body>
</html>
Last edited by Daniil; Aug 24, 2012 at 4:52 AM.
Reason: [CLOSED]