Nov 14, 2012, 9:49 PM
Field Converter to button
Based on the example provided here https://examples2.ext.net/#/GridPane...eld_Converter/
I need to use the same idea but convert all fields except the FundName to buttons with action on server side button click. data will be coming from a store with flags of true or false instead of "y" or "no"
I need to use the same idea but convert all fields except the FundName to buttons with action on server side button click. data will be coming from a store with flags of true or false instead of "y" or "no"
<ext:GridPanel ID="GridPanel1" runat="server" Width="600" Height="350">
<Store>
<ext:Store ID="Store2" runat="server">
<Model>
<ext:Model ID="Model2" runat="server" IDProperty="company">
<Fields>
<ext:ModelField Name="FundName" />
<ext:ModelField Name="CreateLetter" Type="string" />
<ext:ModelField Name="Approved" Type="string" />
<ext:ModelField Name="SendNow" Type="string" />
<ext:ModelField Name="Override" Type="string">
<Convert Handler="return value === 1;" />
</ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ID="Column1" runat="server" Text="Fund Name" Width="160" DataIndex="FundName"
Flex="1" />
<ext:Column ID="Column2" runat="server" Text="Create Letter" Width="75" DataIndex="CreateLetter" />
<ext:Column ID="Column3" runat="server" Text="Approved" Width="75" DataIndex="Approved" />
<ext:Column ID="Column4" runat="server" Text="Sendnow" Width="75" DataIndex="pctChange" />
<ext:CheckColumn ID="CheckColumn1" runat="server" Text="Override" Width="50" Sortable="true" DataIndex="Override" />
</Columns>
</ColumnModel>
</ext:GridPanel>
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.BindData();
}
}
protected void MyData_Refresh(object sender, StoreReadDataEventArgs e)
{
this.BindData();
}
private void BindData()
{
var store = this.GridPanel1.GetStore();
store.DataSource = this.Data;
store.DataBind();
}
private object[] Data
{
get
{
DateTime now = DateTime.Now;
return new object[]
{
new object[] { "3m Co", 1, 1, 1, 1 },
new object[] { "Alcoa Inc", 1, 0, 0, 1 },
new object[] { "Altria Group Inc", 0, 1, 1.1, 0 },
new object[] { "Wal-Mart Stores, Inc.", 0, 0, 1, 0 }
};
}
Please help!!!