PDA

View Full Version : [CLOSED] when gridpanel column apply renderer.format , renderer.fn not work



mis@adphk.com
Mar 12, 2013, 11:23 AM
Dim objRender As New Ext.Net.Renderer
objRender.Format = RendererFormat.UsMoney
objRender.Fn = "editcolor"
mobjExtNet.ExtNetGridPanel_Columns.Item(4).Rendere r = objRender


When remark objRender.Format = RendererFormat.UsMoney
Cell text can change to my Fn setting

Daniil
Mar 12, 2013, 11:35 AM
Hello,

Fn and Format excludes each other. You can use a single one of these options at the same time.

Actually, Format="UsMoney" is just:

return Ext.util.Format.usMoney(value);

So, you can easily implement it with a Fn.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
{
new object[] { 90.99 },
new object[] { 90.99 },
new object[] { 90.99 }
};
store.DataBind();
}
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v2 Example</title>

<script>
var myRenderer = function (value) {
value = Ext.util.Format.usMoney(value);

return value + " test";
};
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="test" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test" DataIndex="test">
<Renderer Fn="myRenderer" />
</ext:Column>
</Columns>
</ColumnModel>
</ext:GridPanel>
</form>
</body>
</html>